Archive

Its been long time i last wrote any post here. Today I am going to show you some use of macports.

Macports – One of the best package manager for mac os x. Its specially helpful for advance user like us, who needs to install lots of *nix packages. And also for developers, to maintain their tools, like apache, php, python, ruby, vi, emacs etc etc. So either you are a advance user or developer, u will like this post.

Here we go:

To use macports, the very first thing you will need to install is the gcc compiler and its helping tool. Don’t get afraid, in mac its very simple to get these tools. Just install the Xcode from your 2nd install DVD, if you don’t have the DVD, you can download it from apple site. it’s free 🙂

After the Xcode is installed get the macports installer dmg from macports.org. Mount the dmg and run the installer. it’s damn simple, but you may have to wait 10-20 minutes to complete the installation (based on your mac configuration).

Congratulation!!! your install processing complete. Now how you will use it.

Install package:

$ sudo port install portname

Searching package:

$ port search packagename

Variants:

A very good feature of macports, you can choice what will be configured/installed along with this package. Like if your installing php5 , you may tell the installer to configure it for apache or fastcgi mode or no_web . That’s the best part of macports. You can pick what you need, and what not. Here is the command format:

$ sudo port variants packagename

this command will give you a possible variants list. you will have to +variants_name after the normal ports install command.

$ sudo port install packagename +variants1 +variants2

Upgrade package:

Upgrade is one of the important reason of using package manger, instate of installing everything separately. You will get all your installed packages almost without any effort.

upgrade a single package:

$ sudo port upgrade packagename

this command will upgrade the package along with the pre-selected variants (if any)

upgrade all packages:

$ sudo port upgrade outdated

This command will upgrade all the outdated application/package to the latest version (of-course you will have to sync ports repo, that i described later.)

Port maintenance:

Though most of the task here, you will do very few time in 2-3 months, but still i am showing it here. As we run one single os for years 🙂

Update repository:

To get the latest changes from port repository. The command is very simple:

$ sudo port sync

Remove inactive ports:

One of the good and bad side of macports is, when u upgrading any existing package, it keep the old versions of the package. After few months of use of macports you may feel the need to clean up the space. Here is the single line command to do it.

$ sudo port uninstall inactive

Cleanup ports:

In long run macports store lots of helping files for the compile process. You may like to run this command sometime after 1-2 months to cleanup some space.

$ sudo port clean –all installed

upgrade macports:

Its even simpler to upgrade your installed ports with single command

$ sudo port selfupdate

or you can check which ports are outdated by running :

$ sudo port outdated

I wrote this post after long time and in very hurry, so there can be some issue or i may missed something. Please let me know, i will fix those.

About me

I am S. M. Ibrahim lavlu aka lavluda working as web application developer, server security and optimization, apps scaling consultant from dhaka, bangladesh. On my free time i like to pass my time for opensource projects.

If you are interested to work with me or hire me, send a mail to smibrahim [at] gmail.com My Linkedin profile