Archive forDecember, 2009

Time Machine & Network Drive – SNOW LEOPARD UPDATE

Small update on the TimeMachine & Network Drive setup. Since I have a new MacPro, I wanted to enable TimeMachine on it. Note that this install is a fresh Snow Leopard installation, and that my MacBook is a Leopard.

I took the steps as I discribed them myself, but it seemed that TM was still trying to create a new sparsebundle instead of using the newly created on.

If you are using Snow Leopard, keep these things in mind:

  • The naming of the sparsebundle file needs to be a tad diffrent. No more use of the MAC address in the filename. You can just use <computername>.sparsebundle
  • One important step to follow is the fact that TimeMachine is now looking for a file called com.apple.TimeMachine.MachineID.plist
    . This file needs to reside inside the sparsebundle directory.
  • So fire up terminal and go to /Volumes/<volumename>/<computername>.sparsebundle
  • open up vi (name the file com.apple.TimeMachine.MachineID.plist and add the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.backupd.HostUUID</key>
    <string>YOURUUIDHERE</string>
</dict>
</plist>

NOTE: Replace COMPUTER UID with the UUID of your MAC. You can find it under the System Profiles on the Hardware tab. Now fire up TimeMachine and everything should be running smooth again.

Comments (17)

Snow Leopard Apache vhosts

Ok, while setting up my working environment, I had to define vhosts for the sites/applications I’m working on. So here is how I configured Apache.

sudo vi +/'# Virtual hosts' /etc/apache2/httpd.conf

This command will open the httpd.conf file and set the cursor at the first line where he encounters the string # Virtual hosts. Now, you could remove the comment block so that Apache would use only one configuration file for all your vhosts, but I find that a bit dirty. I prefer 1 file per vhost. So I added the following line:

Include /private/etc/apache2/extra/vhosts/*.conf

Now, lets set the logging correct. I like the error logs to look like error.log, see the notices and have a custom logformat. So set the following entries like this:

ErrorLog "/private/var/log/apache2/error.log"
LogLevel notice
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined

So now Apache will load all vhost files located under /private/etc/apache2/extra/vhosts ending with a .conf. But watch out, the folder “vhosts” doesn’t exists yet, so you will have to create it!

sudo mkdir /private/etc/apache2/extra/vhosts

Ok, next step is to create the a vhost. In this example, I’ll make a vhost for phpMyAdmin. Create a config file in the newly create vhost folder (phpmyadmin.conf) en insert the following content:

<VirtualHost *:80>
        DocumentRoot /Users/michael/Sites/phpMyAdmin/
        ServerName phpmyadmin.local
        ErrorLog "/private/var/log/apache2/phpmyadmin.error.log"
        CustomLog "/private/var/log/apache2/phpmyadmin.log" combined
</VirtualHost>

Since the phpmyadmin.local url doesn’t exist, we have to tell our system that it is a local url and that no DNS lookup is required. Edit /etc/hosts file to add the url.


127.0.0.1 phpmyadmin.localNow, just restart Apache and surf to the url :)

Comments

My Mac Pro Early 2009 Octo-core

After I got a MacBook from work last year, I realy enjoyed working with OSX. Everything ran smooth, the user interface is polished and I could still do everything I did on Linux and Windows. But a notebook is still a notebook. The screen is not optimized to do heavy programming work (13″) so I always hooked up an external monitor at work or at home. But then came the time that I needed more screen space. One option was to use an external box to hook up more montors like the Matrox TripleHead2Go , but that had its limitations.

So I decided to treat myself to a brand new Mac Pro. Before the final purchase step, I had to make some decisions on the configuration.

The first thing I had to chose from was the CPU: Quad-core vs Octo-core. So I looked at the 2.93 Ghz Quadcore and then at the 2x 2.66 Ghz Quadcore. Now everybody knows that all new CPU’s are already too fast for most of the applications we use. Even today, most applications still don’t use all the posibilies of all the cores a CPU has, and are even not optimized for it. Even the price diffrence wans’t that big between my Quad-core 2.93 and the 2x 2.66Ghz configuration. So what to do!

After looking a bit further, I wanted to upgrade the RAM to 8Gb (4×2Gb). The Quad-core can go up to 16Gb, while the Octo-core goes up to 32Gb. I know that at this point, I have enough with 8Gb, but you never know what the future brings. So I started to look a bit further. When I buy the Quad-core version, and put 4×2Gb in it, all my slots will be used and it would cost an additional 225€. The only solution I have then is to buy bigger RAM. But when you looked at the prices, my hart just stopped pumping.  For the Quad-core version, an upgrade to 3×4Gb RAM runs up to 1215€ and 4×4Gb even up to 1665€. Those prices are just crazy!

So I looked back at the Octo-core version. For 8Gb (4×2Gb), the additional cost is only 90€ . Ok, the bigger RAM is as pricy as its Quad-core equivalent: 6×2Gb / 270€, 8×2Gb / 450€, 8×4Gb / 3330€. I wanted to stick with the 4×2Gb to begin with, but like I said, you never know what the future brings. With the Octo-core version, I still had 4 empty RAM slots, so if I wanted to, I could always upgrade myself, I put in 4 extra RAM modules of 2Gig, which are still affordable.

So that disicion was made, I would buy the Octo-core with 8Gig to start with. Next was the HDD. Well, I staid with the default 640Gb SATA drive, becouse I’m planning to upgrade to an SSD next year. Didn’t need a RAID card either (using TimeMachine for backups).

Ok, next in line is the graphic card. I knew the default Nvidia GeForce 120 512Mb card sucks big time. But I kept it anyway in this configuration. BUT, I also bought the ATI Radeon HD 4870 512Mb separately. Why in gods name I did that huh? Wel, like I said, I needed more screenspace ;) .

And farther down the configuration, I bought one superdrive, 1 Magic Mouse, 1 Apple Keyboard, 1 Air-port extra WIFI card and the Apple Care Protection Plan. I ended up with a bill of 3776,10€ .And no, I’m not a Mac fanboy or have enough money. Working in IT, a computer system is an important working tool for me, but also a hobby. I work hard for my money, but I do like to treat myself to something nice once and a while.

Becouse of some problems with the supply of Magic Mouses, it took 5 weeks before I received my order!

MacPro Tower

MacPro Tower

Radeon

Radeon Graphics card

CPU

CPU block

Monitors

Monitors

Comments

Enable syntax highlighting in Mac OSX Snow Leopard

One of the main reasons I switched to Mac was the fact that the user interface is polished and I still maintain the power and freedom I find Linux. But one downside in Mac Terminal is that there is no standard syntax highlighting.

So here is some info how I got to enable some basic syntax highlighting in Terminal and VIM. Note that these settings are user specific and not system wide.

Fire up Terminal and create a .vimrc file in your home directory.

cd
vim .vimrc

Edit/create /usr/share/vim/vimrc for system wide settings.

Press the ‘i‘ key to switch vim to Insertion Mode, then enter these lines
set ai                  " auto indenting
set history=100         " keep 100 lines of history
set ruler               " show the cursor position
syntax on               " syntax highlighting
set hlsearch            " highlight the last searched term
filetype plugin on      " use the file type plugins

" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif

Press the Escape key to take vim out of Insertion Mode, then press ‘:‘ (colon) followed by ‘x‘ to save the file and exit. Now when you list a directory or edit a file through vi(m) you’ll see that all syntaxes are highlighted.

Long live VI(M)!!

Comments

Installing MySQL on Snow Leopard

Just got my new MacPro this weekend. After installing my common applications, I had to install my develoment tools as well. These are the instructions to install MySQL 64-bit version on OS X Snow Leopard.

First of all, note that we are going to install MySQL compiling from source. So make sure you have installed Xcode tools and you know your way around Terminal ;)

Now lets set up our personal profile where we declare our path variable. Fire up Terminal and create/edit your profile file:

vi ~/.profile

Set your path variable like this:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Close and save the file. Now load the the path variable to your current shell:

source ~/.profile

Now verify your updated path:

echo $PATH

You should see /usr/local/bin at the beginning of the line returned by the system.

Now lets download the MySQL source and start compiling like crazy :

curl -0 http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41.tar.gz/from/http://mysql.easynet.be/
 
tar xzvf mysql-5.1.41.tar.gz
cd mysql-5.1.41
CC=gcc CFLAGS="-arch x86_64 -O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-arch x86_64 -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-shared --with-plugins=myisam,innobase --with-zlib-dir=bundled --with-big-tables --with-readline
 
make
sudo make install
 
cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

Ok, everything should be compiled and installed without problems. Now lets create the launch daemon with the following content

sudo vi /Library/LaunchDaemons/com.mysql.mysqld.plits
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
 &lt;key&gt;KeepAlive&lt;/key&gt;
 &lt;true/&gt;
 &lt;key&gt;Label&lt;/key&gt;
 &lt;string&gt;com.mysql.mysqld&lt;/string&gt;
 &lt;key&gt;Program&lt;/key&gt;
 &lt;string&gt;/usr/local/mysql/bin/mysqld_safe&lt;/string&gt;
 &lt;key&gt;RunAtLoad&lt;/key&gt;
 &lt;true/&gt;
 &lt;key&gt;UserName&lt;/key&gt;
 &lt;string&gt;mysql&lt;/string&gt;
 &lt;key&gt;WorkingDirectory&lt;/key&gt;
 &lt;string&gt;/usr/local/mysql&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;

Change the user to root.

sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist

Now, to start / stop MySQL, run the these commands:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
 
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

Now the last thing todo is to set the root password:

mysqladmin -u root password "mypassword"

Now MySQL should be running smoothly and without problems on Snow Leopard.

NOTE: For the RoR mysql gem, use the following command:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

Comments (3)