Disable/Enable Spotlight in Mac OS with Terminal

Disabling Spotlight in MacOS is pretty easy, launch the Terminal and type the following command:

sudo mdutil -a -i off

This tells the Spotlight manager to disable all indexing on all volumes, the command will require your administrative password to execute.

Re-enabling Spotlight in MacOS is just as easy, just reverse the command to:

sudo mdutil -a -i on

Now Spotlight indexing will be back on and work as usual.

Increase Your Apple Magic Mouse Speed

Magic Mouse Speed Increse
Increasing the magic mouse speed is incredibly simple using just a few Terminal commands. Here is exactly what you need to do:
  1. Open Terminal (Applications > Utilities > Terminal)
  2. Type this command to see your current mouse speed setting:
defaults read .GlobalPreferences com.apple.mouse.scaling


defaults read -g com.apple.mouse.scaling
  1. To increase the speed, enter a new scaling value like so. The default is 3 – try something between 4-12:
defaults write .GlobalPreferences com.apple.mouse.scaling 8


defaults write -g com.apple.mouse.scaling 5
  1. When ready, quit Terminal and reboot your Mac for the new setting to take effect.

That’s all there is to it! Once your system boots back up, you’ll instantly notice how much faster and more responsive your mouse movement is.

The reason this works is it overrides the default scaling value set by Apple. They configure the Magic Mouse Speed out of the box to be slower than the maximum speed allowed in System Preferences. But with this quick terminal command, you can boost it well beyond the standard limit.

Create folder and file from string on MacOS

tell application "Finder"
	display dialog "File Name:" default answer ""
	set fileNameWithPath to the text returned of result
	if length of fileNameWithPath = 0 then
		return 0
	end if
	set thisFolder to the target of the front window as alias
	set oldDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "/"
	set myFolderFileList to every text item of fileNameWithPath
	set AppleScript's text item delimiters to oldDelimiters
	set fileName to the last item of myFolderFileList -- get last item
	if length of myFolderFileList > 1 then
		set myFolderList to myFolderFileList's (items 1 thru -2) --remove last item
		repeat with folderName in myFolderList
			if length of folderName > 0 then
				if (exists folder folderName of thisFolder) is true then
					set newThisFolder to thisFolder & folderName as text
					set thisFolder to newThisFolder as alias
					set thisFolder to make new folder with properties {name:folderName} at thisFolder
				end if
			end if
		end repeat
	end if
	if length of fileName > 0 then
		make new file at thisFolder with properties {name:fileName}
	end if
end tell

MacOS Localhost Permissions for Apache

Are you receiving the dreaded “Connection Information” permission issue on your local Mac OS X environment? You’re not alone – and thankfully there is a simple solution to this issue.

You are receiving this error because the default webserver user which runs httpd is known as _www, which is not the user in your local account. If you’re the only person that uses your machine, you can change the user to fix the permission issue.

In the terminal, type the following and hit enter:

This will return a string of information, however the only information you need is the primary user uid and group gid names.
uid=501(admin) gid=20(staff)

Once you have this information, you will need to edit your httpd.conf file. Type the following:
sudo nano /etc/apache2/httpd.conf You’ll likely need to type your admin password to edit his file.

Hit Ctrl+W to search the file for “User “. This will take you directly to the place in the file where you need to edit information.

You can see in this file that I commented out the existing user and group with the # sign.  Below that I entered the User and Group from the information I found in step 2.

You need to restart apache for the change to take effect.
sudo apachectl restart

Congratulations, you are now running httpd as your local account.