Thursday, November 27, 2008

Keeping MacPorts clean

In a previous post, I wrote about how to clean up your installation of MacPorts. After haveing gone through the steps previously described, it might be a good idea to keep your installation of MacPorts clean.

It turns out that there is a way to keep the installation clean all the time. If you run the command

sudo port -nuf upgrade outdated

in a command shell, MacPorts will uninstall any outdated versions of any packaged it upgrades. We do need to force (-f) the installation, as MacPorts believes that you need the old versions. When checking for dependencies, it does not take the version into account. Since we are installing a new version, this is OK.

UPDATE: jmr pointed out in a comment that it is no longer necessary to the "nf" flags, as the bugs that made them necessary have been fixed. See his comment for more details.

Thursday, November 20, 2008

Stop password expiry in Windwos Vista

By default, Windows Vista will prompt you to change your password every 42 days. This is very annoying, but at techblissonline.com, they have a solution. Just start a command prompt as administrator and type in the following:

      net accounts /maxpwage:unlimited

There should be no more need to change the password unless you choose to your self. If you would just like to change the number of days between password changes, type in the number of days (between 0 and 999) instead of "unlimited".


Wednesday, November 19, 2008

Making Lepoards help window go behind other windows

On of the things that really bug me with Leopard, is that the help window always stays on top of other windows. I found this tip (and I should have written down where I found it) that allow other windows to go on top of the help window. 

If you type the following command in a terminal window

  defaults write com.apple.helpviewer NormalWindow -bool true

the help window should fall behind other windows. You will have to click on the window to get it back to the front. In my world, this is so much better. 

If you would like to have the old behavior back (the help window always on top) just use the same command, but change "true" at the end to "false".



Monday, November 10, 2008

Cleaning up MacPorts


I am running MacPorts on my laptop. Unfortunately, the laptop have a limited amount of space on the hard drive, so I constantly have to keep trimming away things that I do not need.

I noticed that my MacPort folder was growing quite a bit, and I wondered if it would be possible to trim what was in the MacPorts folder without removing any of the applications? After searching a little on the net, I discovered a few interesting things.

It seems as though MacPorts, when upgrading to a new version of an application, leaves the old version behind. After a while, this will eat up quite a bit of your precious hard disk space. So in order to see what you have installed on your machine, type in the following:

port installed

There will probably be a lot of ports installed, and only the ones marked "(active)" are used. The rest may be removed. Before doing so it might be fun to see just how much space MacPorts is using. I run the command

du -sh /opt

This will give you an aproximate value for the disk space occupied by MacPorts. On my machine (which already have been cleaned once) it reports 2.5G. The next step is now to remove all the old versions. I would start out by doing a "clean" for all the installed ports. You do this by typing

sudo port clean --all installed

This erases all temporary files in that are being generated during a build of an application. Only things that can be rebuilt are removed in this step. For fun you could run the "du" command again, to see what your savings are. It might not be much at the moment, but on my system I now ended up with 2.7G, a saving of 200MB.

Now for the actual removal of the old versions. This is accomplished by this command:

sudo port -f uninstall inactive

My first attempt was a bit longer, but it also did the trick:

port installed | grep -v "(active)" | while read i; do sudo port -f uninstall $i; done

This will give you an error message as the first line of output is "The following ports are currently installed:", and since there are no port with that name, it will fail, but continue. This is harmless, and I decided that creating a fix for this would make the command line more complicated that necessary. Anyway, after running the first command, the "du" command showed my /opt directory to be 2.6G. I had run this series of commands before, so my savings were not that grate this time around, but the first time I saved almost 1.5G.

I hope this was to some help for some of you.

Sunday, November 9, 2008

The first post

This is my first post on this blog, or any blog for that matter. I have used a tumblr blog for short and interesting link etc. but here I will try to write longer texts.

The content of the blog will be a mix of what I happen to find interessting at the moment. Since I am very interested in computers, that will probably be a topic I will return to as the time goes by. I will post hint and triks that I come across.

I am mostly using Macs at the moment, but I also use Linux and Windows machines quite a bit, so thre might be a mix of information here.

So, lets get on with it. Lets start blogging. :-)