Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to follow this tutorial, on the subject of compiling ruby and rubygems on Snow Leopard:

I have added this to my ~/.profile:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

But if I write: echo $PATH I get:


But in tutorial it says:

You should see /usr/local/bin at the beginning of the line returned by the system.

I have installed macports sometime ago and plenty of other software, perhaps it has changed the path.

Anyway, I have tried to proceed with the installation, so I have built ruby, I did:

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
sudo make install
cd ..

But when I do which ruby I get:


And according to the tutorial that's wrong. Also if I do ruby -v I get the older version of ruby that was preinstalled on Snow Leopard and not the one I've compiled.



This is content of my ~/.profile:

export PYTHONPATH="/Users/m/djangocode:$PYTHONPATH"

alias hibernateon="sudo pmset -a hibernatemode 5"
alias hibernateoff="sudo pmset -a hibernatemode 3"

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I have deleted ~/.bash_profile, so it has no impact.

Here is the content of /etc/bashrc:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize

and /etc/profile:

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc

I think their contents are Mac OS X defaults. I never touched these.

If I open terminal up and type echo $PATH I still get:


But if I do: source ~/.profile then I get what I need:

misha-macbookpro:~ m$ . ~/.profile 
misha-macbookpro:~ m$ echo $PATH

And there is no ~/.bashrc file.

It seems that ~/.profile doesn't get "sourced" on terminal's start up. What can cause that?

share|improve this question
You should probably make changes to your path in ~/.bashrc. Also, /usr/local/bin should come before /usr/bin and /bin. You should investigate where it's being set otherwise. Perhaps in ~/.bashrc, /etc/profile or /etc/bash.bashrc. – Dennis Williamson Jun 13 '10 at 15:48
up vote 1 down vote accepted

set something like this in your ~/.bash_profile:


MacPorts is already changing your $PATH in that file, so make your modifications there (MacPorts is the /opt/local tree)

share|improve this answer
thank you, indeed it was the line from ~/.bash_profile (I deleted it, since I don't have MacPorts installed anymore and I don't use it, I use Homebrew). – gryzzly Jun 14 '10 at 14:00

You should seriously consider Homebrew

share|improve this answer

Apple's Terminal uses the ~/.bash_profile, not a .bashrc nor a .profile. Yes, its a bit annoying.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.