Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to follow this tutorial, on the subject of compiling ruby and rubygems on Snow Leopard:
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-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:

/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

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
make
sudo make install
cd ..

But when I do which ruby I get:

/usr/bin/ruby

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.

Thanks.

UPD:

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
   return
fi

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`
fi

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

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:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

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

misha-macbookpro:~ m$ . ~/.profile 
misha-macbookpro:~ m$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

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
1  
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

3 Answers 3

up vote 1 down vote accepted

set something like this in your ~/.bash_profile:

PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH

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

 
discard

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.