Abbey Workshop

General Mac OS How To's

General Mac OS How To's

This page is dedicated to general Mac OS X tips that are too small to fit on their own pages.

Changing Your Default Login Shell
Java Directories on OS X
Setting the Host Name for a Mac with OS X

Changing Your Default Login Shell

Your default login shell determines which UNIX shell you will use in your terminal shell while using OS X. The default in OS X 10.1 and 10.2 were the tcsh shell. And now with Panther, 10.3, its the bash shell. Whatever shell you what to use, you can select it easily. First, find the location for your target shell by typing (e.g., bash):

$ which bash

This should return something like:

$ /bin/bash

Now use that path with the following command to make it your default login shell:

$ chsh -s /bin/bash

The next time you login, your shell should be whatever you entered in the chsh command above.

Back to Top of Page

Java Directories on OS X

The location of key Java directories is a little bit different on OS X as compared to other operating systems. Apple has written a detailed article on this subject that is linked below. The following table lists the key directories:

Directory Name Path Notes
Java Home /Library/Java/Home Set your JAVA_HOME environment variable to this directory. This is a symbolic link that will be updated each time Java is updated on Mac OS X. Therefore, you should point to this directory to have the value automatically updated.
Extensions /Library/Java/Extensions
~Library/Java/Extensions
Java software on other platforms often makes use of the lib/ext directory within a JDK installation to store support class or jar files. Apple has taken the same approach with the extensions directory as they did with JAVA_HOME. Put system-wide jar files in the first directory. Put any personal or test .jar files in the second directory. Jars included in these directories will be loaded automatically with having to set the CLASSPATH environment variable.
User Preferences ~/Library/Preferences
/Library/Java/Extensions
Java software that use preferences will store their data in the first directory. System-wide preferences are stored in the second directory.

The original article can be found here on Apple's developer site.

Back to Top of Page

Setting the Host Name for a Mac with OS X

This little tip solves a problem I had in the terminal window because of my shell configuration. I use the bash shell and include the host name in my prompt. For example, my prompt looks something like this:
host:~/dir $

When using DHCP the host name is set by the DHCP server. Sometimes the name provided is really long or cryptic. Very annoying when the host name is 25 characters long.

Fortunately, this problem can be fixed fairly easily. To set your host name to a fixed value, follow these steps:

  • Become superuser (sudo bash)
  • cd into the /etc directory
  • Edit the hostconfig file. At the top of the file you will see a HOSTNAME variable. Change the HOSTNAME value from AUTO to the name you want. Save the file
  • Restart your Mac. When the system comes back up the host name in your terminal window should be the value you just set.
Back to Top of Page