From Lyceum
Jump to: navigation, search

This is a quick guide to installing Darwin ports under OS X 10.4

Darwin ports in similar to the ports tree in Freebsd, providing easy building and installation of thousands of applications for OS X.

You must first install the development tools for OS X which include development libraries, the gcc, header files, etc. required to build applications. Darwin ports requires the C compiler and libraries to be installed in order to install the ports package itself.


Apple Developer Tools

Download X Code version 2.5 or latest for your platform (PPC, intel, etc.) from the Apple Developer site:

https://connect.apple.com/

This is about a 900MB download.

Mount the .dmg file and install the development tools themselves. Documentation is included.

You can verify it is install correctly by typing gcc into a terminal:

ChangeMe-2-Prod-2:~/Documents archimedes$ gcc
powerpc-apple-darwin8-gcc-4.0.1: no input files
ChangeMe-2-Prod-2:~/Documents archimedes$  

Showing the gcc compiler is now installed, but no input file to compile was specified.

X11 for OS X

You should install X11, the X windows GUI environment for OS X. You and do this by either installing it from you OS X install disk, or better just download and install the latest version 1.1.3 directly. Installation is very straight forward.

http://www.apple.com/support/downloads/x11update2006113.html

As an aside - now that you have X11 installed, why not install the GIMP for OS X? It's no more than a new clicks away at this point: http://www.macgimp.org/

Darwin Ports

Once X Code 2.5 is installed as above, installing Darwin Ports is quite straight forward.

The full instructions can be found at: http://darwinports.com/ as well as http://www.darwinports.com/install/

1) Download darwin ports 1.5 or latest

2) Mount the .dmg file and then install Darwin Ports.

Important Step

3) You MUST include some additional directories in your path so that OS X will be able to find the binaries included with Darwin Ports (i.e. the port command itself) and packages you install with it. Simple execute these commands in the terminal:

export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

And verify the path is set correctly and that it now includes /opt/local/bin by using echo $PATH from the terminal:

ChangeMe-2-Prod-2:~/Documents archimedes$ echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin

4) Update the port package with:

sudo port -d selfupdate

This will check the requierments for the build environment which is why X Code 2.5 was installed earlier. It will them compile a few things.

Note that at the end it will display the location where Darwin Ports was installed to, for example:

/opt/local/var/macports/sources/rsync.macports.org/release/base

5) You may now install packages from ports by building them from the source code. See the following examples and documentation at http://darwinports.com/


Installing TightVNC

TightVNC is a popular VNC server for X. This is usefull for connecting to you Mac if you are running X windows and using X apps. This will NOT directly allow you to connect to the normal OS X quartz / Aqua desktop remotely - to do that you may use other OS X VNC apps such as VineVNC Server which work quite well.

Installing TightVNC from Darwin ports consists of:

1) From a terminal run:

sudo port install tightvnc

2) It build and install the app. After this, you will need to specify a path to X executables which are required for TightVNC:

export PATH=$PATH:/usr/X11R6/bin/

3) You may now run TightVNC with

vncserver

4) There are also other vnc apps installed, such as vncviewer to allow you to connect to other systems (OS X, Linux, etc) running VNC servers. vncpassword obviously sets the password for you vns sessions.

ChangeMe-2-Prod-2:~/Documents archimedes$ vnc
vncconnect  vncpasswd   vncserver   vncviewer


Installing MTR

Here is an example of using Darwin Ports to install MTR - a popular networking utility for route analysis:

ChangeMe-2-Prod-2:~/Documents archimedes$ mtr
-bash: mtr: command not found

Darn, don't have MTR installed, no worries . . . 

ChangeMe-2-Prod-2:~/Documents archimedes$ sudo port install mtr
Password:
--->  Fetching mtr
--->  Attempting to fetch mtr-0.72.tar.gz from ftp://ftp.bitwizard.nl/mtr/
--->  Verifying checksum(s) for mtr
--->  Extracting mtr
--->  Configuring mtr
--->  Building mtr with target all
--->  Staging mtr into destroot
--->  Installing mtr 0.72_0
--->  Activating mtr 0.72_0
--->  Cleaning mtr

ChangeMe-2-Prod-2:~/Documents archimedes$mtr cnn.com

If mtr is not found you most likely do not have /opt/local/sbin set in your path, see above. If path is exported, mtr will run:

                                       My traceroute  [v0.72]
ChangeMe-2-Prod-2.local (0.0.0.0)                                                                           Sat Nov 24 18:01:08 2007
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
                                                                                            Packets               Pings
 Host                                                    Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 192.168.2.1                                           0.0%     6    1.9   1.8   1.8   2.0   0.1
 2. 10.97.96.1                                            0.0%     6    7.8   8.4   6.9   9.9   1.1
 3. pch15.51.tampflerl-rtr2.tampabay.rr.com               0.0%     6   10.6  13.6  10.5  18.4   3.7
 4. pos6-0-OC-192.tampflerl-rtr4.tampabay.rr.com          0.0%     6   11.4  15.9  10.3  37.8  10.8
 5. pop2-tby-P3-0.atdn.net                                0.0%     6   13.0  11.8  10.7  13.0   0.9
 6. bb1-tby-P0-3.atdn.net                                 0.0%     6   14.3  32.7  10.8 133.8  49.5
 7. bb2-atm-P2-0.atdn.net                                 0.0%     5   23.1  24.0  22.8  25.9   1.3
 8. ???


Installing smartmontools

ChangeMe-2-Prod-2:/opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/smartmontools/work/smartmontools-5.37

$sudo ./configure $sudo make $sudo make install

Places it in /usr/local/sbin

mieren$ /usr/local/sbin/smartctl -a /dev/disk0s9

($mount will show you the /dev/drive to use)

####################################################################
#
#                       PLEASE READ THIS BOX!
#
#   To manually start the smartd daemon, run:
#   /usr/local/etc/rc.d/init.d/SMART/SMART start
#
#   To automatically start smartd on bootup, add the line:
#   SMARTd=-YES-
#   to /etc/hostconfig
#
#   smartd can now use a configuration file /usr/local/etc/smartd.conf. Do:
#   man smartd
#   to learn about it. A sample configuration file can be found in:
#   /usr/local/share/doc/smartmontools-5.37
#
####################################################################


Thousands of other applications are now available to you using the same methodology. You may also learn more about a particular port with:

port info mtr

GUI for Darwin Ports

Of course if you want a GUI for interacting with Darwin Ports, there are a few available. Checkout both PortAuthority (Shareware) and Porticus 1.0b4 (Open Source) - find both on version tracker:

http://www.versiontracker.com/dyn/moreinfo/macosx/32608