MacPort on Mac OS X Lion


If you have performed a fresh install of Mac OS X Lion or if you plan to install MacPort after having installed Lion, you will soon realize that the MacPort team does not distribute (yet) a Lion installer.  Snow Leopard installer will fail when detecting Lion.

Question is therefore : how to install MacPort on Lion ?  Answer : install it from the sources.

It might be scarry, but it is very easy, here are the details.

Preriquisite : install Aple’s development tool XCode.  It is freely available from the App Store (be patient it is a 3.5 Gb download)

  • Open a terminal
  • create a directory for the sources
mkdir macport.sources
  • Fetch the sources

cd macport.sources
sudo svn checkout http://svn.macports.org/repository/macports/trunk

  • Compile
cd trunk/base
sudo ./configure --enable-readline
sudo make install
  • Install
sudo make distclean
  • Change your profile to include MacPort in the PATH
vi $HOME/.profile
#!/usr/bin/bash
# MacPort
export PATH=$PATH:/opt/local/bin
  • Source your profile to include the changes
. $HOME/.profile

That’s it ! Easy as I promised.

You can now search for package with

sudo port list | grep <your search>

and install packages with

sudo port install <package name>

Enjoy !

, , , ,

  1. #1 by stef on 30/07/2011 - 21:33

    Hi i lose the way at change your profile to include MacPort in the PATH, can you more explain me this part please

  2. #2 by sst on 31/07/2011 - 08:40

    Your profile is defined in a file named “.profile” in your home directory. You can edit it with any text editor you want.
    I am using vi, from the Terminal.

    1/ from a Terminal, type vi $HOME/.profile
    2/ type “i”
    3/ copy (CMD-V) the three lines from the blog post
    4/ type ESC : w q to qui vi

  3. #3 by steve on 15/02/2012 - 15:07

    Nice and clean. Thanks for taking the time to write this down. Worked great.

  4. #4 by herman on 18/05/2012 - 22:28

    Thanks!!!! this worked! Damn how i struggled before

  5. #5 by monia on 31/01/2013 - 15:46

    Many thanks for your effort

(will not be published)