Oh man I just realized that I never ran “sudo port uninstall inactive” and I have reclaimed… hmm… 5 gigs? It’s as simple as that – if you’re using macports for a while and you’ve been using “sudo port upgrade outdated” to upgrade, make sure you remove the old versions because after a while that space really adds up! I don’t know why I thought that upgrading a port removed the old version? I bet it’s in the documentation somewhere (yes, it’s time for me to RTFM haha)
Tag Archive: os x
Does it work? The answer is yes! ![]()
All you have to do is edit the sshd_config file on the OpenBSD machine and set X11Forwarding to yes, then fire up X (I’m using XQuartz 2.3.2 (xorg-server 1.4.2-apple18)) and in an xterm (or Terminal.app!) enter
ssh -Y user@openbsd_machine program
Voila!
P.S.: Actually, you don’t even have to start X on either end of this connection, it will still work. I just tried
If you have a mac and use wireless to connect, you might expect that it will automatically join your wireless network after you tell it to “remember this network”. I know on my old powerbook it did, and on my girlfriend’s macbook it auto-joins too. So I started wondering why my macbook pro just wouldn’t do it. I searched the keychain and found my network in the login keychain, so I thought something really bizarre was going on. When I checked console (the console app in /Applications/Utilities) it said my network wasn’t in the system keychain!
To make a long story short (as my mother would say), I found a solution here: http://discussions.apple.com/thread.jspa?messageID=6757490
It turns out that when I moved System Preferences to /Applications/Utilities it broke my mac’s ability to add networks to the system keychain! I moved it back to /Applications, deleted the network from my network preferences and keychain and then joined the network again. This time the network was added to the system keychain and all is well!
The DHCP server at my office was reconfigured yesterday and it started forcing my macbook pro to change it’s name. I like having my host name remain constant for various reasons, so I asked in #macosx and some kind user there pointed me to this blog post:
It works on leopard, in case you’re wondering! Solved my problem after a reboot.
If you installed Security Update 002 for leopard and suddenly ssh tells you “bus error”, the answer lies here:
http://discussions.apple.com/thread.jspa?messageID=6863360#6863360
Apparently the guys at rogue amoeba have some work to do – we need instant hijack!
If you are too lazy to read that thread, the fix is:
sudo /usr/local/hermes/bin/hermesctl unload
thereby uninstalling instant hijack and fixing the problem. Somehow…
… and here’s the fix from Rogue Amoeba:
http://www.rogueamoeba.com/utm/2008/03/19/security-update-2008-002-compatibility-fix/
Imagine you’re a PHP developer that uses OS X. You’re given 50+ php files that all have a line that needs to be changed. 50 files, one change? Hmmm sounds like maybe I could use automator to do this! Well I don’t know how to use automator
Luckily, I’m a unix geek, and even more luckily, OS X has a fairly strong unix back end and a great terminal emulator. So how does that help? Well if you’re a unix geek you know that this sort of problem just screams “SED! use SED! this is what SED IS FOR!” And it’s true. This is where sed is great.
Say you want to change this line:
$config_file = $_SERVER['DOCUMENT_ROOT']."/dev/config.php";
To this:
$config_file = "dev/config.php";
As a matter of fact… wait a minute! I don’t want to just change that line… no I want to be able to show what I’ve changed, so that the next person who looks at this can see what it used to say. In this instance it’s also important to show the work I’ve done because I’m making changes to someone else’s work. So what I want to do is comment out the line and then add a new line with my change underneath. Sounds a bit more complicated right? Well it’s not really – unless you’re using OS X (you’ll see why in a minute *sigh*). The goal is to end up with this:
//$config_file = $_SERVER['DOCUMENT_ROOT']."/dev/config.php"; $config_file = "dev/config.php";
On the linux machine I keep around the office the command to perform this change on the all php files in the current directory looks like this ( I had to split the line to fit on the site):
sed -i .bak "s/^\$config_file = \
\$_SERVER\['DOCUMENT_ROOT'\]\.\"\/dev\/config\.php\"\;/\/\/\
\$config_file = \$_SERVER\['DOCUMENT_ROOT'\]\.\"\/dev\/config\.php\"\;\
\n\$config_file = \"dev\/config\.php\"\;/g" *.php
The breakdown of the above command is as follows:
sed | the sed command
-i .bak | the -i option means do this change “in place” and copy the original file to originalname.bak
“ | we use the double quote here to start the sed command because there are single quotes in the command
s/^\$config_file =
\$_SERVER\['DOCUMENT_ROOT'\]\.\”\/dev\/config\.php\”\;/\/\/\$config_file
= \$_SERVER\['DOCUMENT_ROOT'\]\.\”\/dev\/config\.php\”\;\n\$config_file = \”dev\/config\.php\”\;/g | this is the magic of sed. it looks for the line we want to change, adds // to the beginning of it, adds a new line after it, and then adds the text that we want after the new line. Amazing isn’t it?
“ | the command ends with the double quote
and, finally:
*.php | represents all of the files that end in .php in the current directory.
Now if you thought that was a mess, check out how that command needs to look in order to work on OS X (10.5.1, possibly other versions)
sed -i .bak "s/^\$config_file = \ \$_SERVER\['DOCUMENT_ROOT'\]\.\"\/dev\/config\.php\"\;/\/\/\ \$config_file = \$_SERVER\['DOCUMENT_ROOT'\]\.\"\/dev\/config\.php\"\;\ \\"$'\n'"\ \$config_file = \"dev\/config\.php\"\;/g" index.php
The crazy part here is the need to use \\”$’\n’”\
What that represents is an escaped version of the literal newline character. With the version of sed currently in OS X, that is the only way (that I could find) to add a newline character with sed. Now you know too.
So that concludes this edition of mac unix geekery… until next time…
I just noticed that when you use the mysql 5 client from MacPorts (installed as /opt/local/bin/mysql5) to connect to a mysql5 server running on localhost that was installed via the package at dev.mysql.com, an error is generated:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysql5/mysqld.sock’ (2)
This is because the installation of mysql 5 server from the mysql site uses /tmp to hold the socket file. Of course if you read the README you’d know this:
“The installation layout is similar to that of a `tar’ file binary
distribution; all MySQL binaries are located in the directory
`/usr/local/mysql/bin’. The MySQL socket file is created as
`/tmp/mysql.sock’ by default.”
I, of course, did not read the README first, and so I wondered what I was doing wrong. The fix is easy, just add
-S /tmp/mysql.sock
to your mysql5 command to use it without any configuration (i.e. changing the location of the socket).
The other day I acquired a hardly used PowerMac G4 from someone who was going to throw it out. Imagine that? It’s got a 450Mhz PPC CPU, 256MB of RAM, a 20GB hard drive, and AGP video. Certainly this nice little machine can be used for something… But what?
Though I could probably get away with an install of OS X Tiger, I knew in my heart that it would be wrong to use the Tiger install disk that I have to install it on a second machine. Actually I just thought it would probably run too slow, but hey it’s still illegal and that’s not how I do things… right? Right. So it was just a question of whether it would be Linux, NetBSD, OpenBSD, or some other free OS. I decided to try NetBSD first.
NetBSD has supported PPC for a while, just one of the many architectures supported by the ultra portable BSD. The story here is fairly short and somewhat funny – I was able to install the OS but never figured out how to get it to boot. Lesson learned: Knowledge of Open Firmware is essential when you’re dealing with an Apple PPC machine like the PowerMac G4. I found this site and this site to be helpful, as well as the install notes for NetBSD. Oddly though, even following the notes to the letter I was unable to boot the OS. I gave up after seeing that my Open Firmware 2.4 system might not be supported at all due to what might be a “broken” Open Firmware. In hindsight I think I was just using the wrong device designation in my boot command. I might try it again.
In part II of the Golden Apple Project I try out Terra Soft’s Yellow Dog Linux. Which operating system will win the right to run on my shiny old G4? Stay tuned to find out!
It’s easy to install OpenBSD on mac hardware the right way. Simply download what you need and follow the install guide. What’s not so easy is installing OpenBSD the wrong way. This guide is intended to help someone who may have gotten anxious and strayed from doing things The Right Way(tm) [see also, The Easy Way(tm)]. It is also a warning. RTFM. Read it twice.
Take notes. Installing OpenBSD can take as little as 20 mins or as much as the rest of your life…. It all depends on how you approach it. This is the rest of your life approach ![]()
With all that said, let’s get down to business.
I’m experimenting with Spam Sieve to see if it can replace Mail.app’s dumb junk mail filters. I trained Mail’s junk filters for about a year and I still got spam last week. Obvious spam at that. It’s just silly. Thunderbird for Mac has great junk filters but no direct tie-in to the Addressbook. SpamSieve adds better bayesian filtering to Mail and entourage (but please don’t use entourage – it’s a tech support nightmare. thx.) I’ve been training it for a couple days now and it’s doing well. I’ll post again in a few days to note the progress. At the end of my 30 day trial I’ll definitely be posting whether or not I feel that it’s worth the $25 that the devs are asking for it
Stay tuned!
THIS JUST IN – Trial ended and I decided to go buy it. read on! View full article »
