Archive for ‘OSX’ Category
Did you know that you can have Mac OS X run a script whenever you log in to your computer? You can if you create a “login hook.” A login hook tells Mac OS X to execute a certain script when a user logs in. Unlike Startup Items that open when a user logs in, a login hook is a script that executes as root. This advanced article shows you how to set up a login hook.
With a login hook:
* The script specified as a login hook must be executable.
How to set up a login hook
Mac OS X 10.3, 10.4, or later
Note that with Mac OS X 10.3.x and 10.4.2 or later, you can use the alternative method at the bottom of this document instead, if you wish. For Mac OS X 10.4 and 10.4.1, you should always use the following steps:
1. Open Terminal (Applications/Utilities).
sudo defaults write com.apple.loginwindow LoginHook /path/to/script
(where /path/to/script is the full path to the script that you want to execute when a user logs in—it doesn’t have to be in the user’s Home directory).
This modifies the /var/root/Library/Preferences/com.apple.loginwindow file.
3. Type your password at the prompt, then press Return.
In OS X it is easy to create as many user accounts as you need. It’s definitely useful being able to have an account for each family member, or an account just for troubleshooting. However, this also leads to an extremely long list on the login window, and an annoying scroll bar down the side.
If you are running Tiger, hiding user accounts that you rarely use is simple. Firstly, go to the Accounts pane in System Preferences, and find the “short name” of each user you want to hide. Once you have these, open up Terminal (Applications/Utilities) and enter the following:
sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add shortname1 shortname2 shortname3
Obviously shortname1, 2 and 3 will be replaced with the short names of the user accounts you wish to hide. You can hide as many as you like, just separate each with a space.
To make a hidden name appear again, type the command with no names in it, therefore resetting the list of hidden users.
sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add
Notice that doing this adds an extra option to your login window – “Other…” When you select this, you will be presented with text boxes to enter a username and password.
By modifying this small setting, you can make the Dock show which applications are hidden by displaying them as a semi-transparent icon. To do this, open up the Terminal (Applications/Utilities) and type the following:
defaults write com.apple.Dock showhidden -bool yes
For this change to take place, you have to relaunch the Dock, using Activity Monitor. Do this by loading up Activity Monitor (Applications/Utilities) and typing dock into the search field. Quit the process named dock.
To cancel this change, and return the icons to normal, repeat the above command in the terminal, but replace yes with no.
You can make Finder quit-able by issuing the following command in Terminal window:
defaults write com.apple.finder QuitMenuItem 1
You’ll need to option-click and hold on the Finder’s Dock icon, and then relaunch the Finder to see your changes take effect. The new Finder process will have a Quit menu option which allows you to quit Finder whenever you don’t need it (this even saves a few Mb’s of RAM).
By default, Mac OS X’s Finder keeps system files – which generally start with a dot, like .bash_profile – out of your sight. But that makes editing one of these files extremely difficult if you, say, want to customize your Terminal prompt.
Execute the following in terminal (to undo the change set TRUE to FALSE):
defaults write com.apple.finder AppleShowAllFiles TRUE
You’ll need to option-click and hold on the Finder’s Dock icon, and then relaunch the Finder to see your changes take effect.
In a Terminal window, type:
defaults write -g AppleICUTimeFormatStrings -dict-add 2 “MMMM d, y hh’:’mm’:’ss’ ‘a”
Press Return and then type:
Press Return again and the menu bar will disappear — click anywhere on the desktop to reload it, if necessary. Bingo…Long format clock.
Open up a terminal window and type the following command:
This command will give you info on what version of OS X you’re running. You can also try the traditional UNIX command:
this returns Darwin information on OS X.
The Finder uses visual feedback to let you know what it’s doing. For instance, when you double-click on a folder to open a new window, you get a subtle zoom-out effect. This helps you understand what your machine is doing, but they can also make a not-so-powerful machine feel slower than it is. With a little help from Terminal, you can disable some or all of the Finder’s animations.
Launch Terminal and type the following command:
defaults write com.apple.finder DisableAllAnimations -bool true
This command disables the animations, but to see the changes, you need to restart the Finder. The safest way to do this—to log out and log back in—is also the most time-consuming. Instead, just hold down the option key and then click and hold on the Finder’s Dock icon. When the pop-up menu appears, select Relaunch.
After the Finder has relaunched, you’ll find that window-opening and -closing animations, as well as roll-down and roll-up animations in the Get Info window, have vanished. You won’t gain any real speed increases, but the Finder will feel snappier than before.
Another option is to reinstate the window animations while leaving the Get Info animations disabled. Return to Terminal and type these two commands:
defaults write com.apple.finder DisableAllAnimations -bool false
defaults write com.apple.finder AnimateInfoPanes -bool false
The first command reverses what you did previously. The second tells the Finder to disable only the Get Info animations. Again, you’ll need to option-click and hold on the Finder’s Dock icon, and then relaunch the Finder to see your changes take effect.
To enable the Get Info animations, repeat the last command but type true at the end instead of false , and then relaunch the Finder again.