Archive for ‘osx Server’ Category

OSX Server: Could not setup Mach task special port 9

datePosted on 12:57, August 26th, 2010 by Many Ayromlou[1] (0x10f860.cron[43786]): Could not setup Mach task special port 9: (os/kern) no access

If you’re seeing this warning/error in your OSX Server log files, it is more than likely caused by cron running jobs for mailman subsystem. Even if the Mail process is disabled in Server Admin, OSX will try to run these cron jobs. The way around this (only do this if you’re NOT running mail server or mailman mailing list manager on your box) is to comment out all lines in /usr/lib/cron/tabs/_mailman file (insert a # character at the beginning of each line that doesn’t have it). This fixed the problem for me…..hopefully it will also work for you :-).

Duplicating service settings under OSX Server…

datePosted on 14:17, August 25th, 2010 by Many Ayromlou

This mainly applies to how you deal with a backup DHCP server and it’s configuration, but might also be useful for backing up other service settings. One of the things that kinda bugs me about how some services are configured in OSX Server is the fact that the configurations are stored in the directory. For example, if you have a DHCP server servicing a subnet with a ton of reservations hardcoded in it, there is no way of editing and/or moving the information from the command line (ie: there is no single config file that contains the current configuration) to another server. That’s where the “serveradmin” commandline program comes to rescue. If you have two identical servers (ie: both running the same OSX server version), you can use serveradmin to export the settings from a specific service and then move the file to the new server and import it there. All using the CLI.

  • To Export the settings (in this case the DHCP service):
  • sudo serveradmin settings dhcp > dhcp-config.txt
  • To Import the settings on the other server:
  • sudo serveradmin settings < dhcp-config.txt

MySQL Replication howto for Snow Leopard…

datePosted on 16:58, August 23rd, 2010 by Many Ayromlou

We recently upgraded our servers from old XServe G5’s running Tiger to the latest greatest running Snow Leopard. In this small howto I will deal with the procedure I followed to setup mysql master-slave replication between two new servers. I start out with two (master, slave) empty DB’s, setup the replication and then import my data from a third server (my old G5 X-Serve). Of course like anything else I will try to show you how to get out of — what I like to call — Steve Jobs Hell Holes :-). There are other ways of doing this procedure, for more info check out this page.

– First things first….the magic command that stops mysql server from command line, just in case you screw something up and need to restart (This should be used on your master and slave servers prior to them going live…..DO NOT USE THIS ON A LIVE SERVER):

sudo launchctl unload /System/Library/LaunchDaemons/org.mysql.mysqld.plist

This will stop the launch Daemon from continously launching mysql when trouble is brewing. This usually happens when you screw something up badly and the symptom is that the Server Manager Status for MySQL will say “Starting up“, but never changes to “Running“.

– Next I want to blow away my DB files on the master and slave (remember these are NOT production servers yet…..I’m still rebuilding them. You DO NOT want to remove the DB’s on your production servers). You’ll need to find the path in the “Settings” tab of the server manager, under “Database Location“. I removed everything in that directory (rm -rf *) from the command line. AGAIN, I CAN NOT STRESS THIS ENOUGH, BE CAREFUL WHERE YOU ISSUE THESE COMMANDS.

– I did this on both the master and the slave.

– Now on the Master change the following in /etc/my.cnf (You should have this file, if you’ve got a my.cnf.default, copy it my.cnf).


– On the Master still, check the “Allow Network Connections” check box in Server Manager and set the root password (for mysql) by pressing the “Set MySQL Root Password…” button. Then press “Save” followed by “Start MySQL“. This will initialize mysql with the default tables and setup the root password.

– Now on the Slave change the following in /etc/my.cnf (You should have this file, if you’ve got a my.cnf.default, copy it my.cnf).


– Back on the Master, you need to create a user (I call it repl) that has REPLICATION SLAVE privilege. Use the following two commands (make sure you replace and slavepass….LEAVE repl as the userid:

mysql> CREATE USER 'repl'@'' IDENTIFIED BY 'slavepass';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'';

– Next we need to flush the tables and issue a read lock (yes, just because we can):


– Still on the master we find out the current binary log file name and position:

mysql> show master status;
 | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
 | mysql-bin.000004 |      340 |              |                  |
 1 row in set (0.00 sec)

Note down the filename and the Position number. We will need them later.

– Back on the Slave, go to Server Manager and set the root password (for mysql) by pressing the “Set MySQL Root Password…” button. Then press “Save” followed by “Start MySQL“. Connect to the DB as root and issue the following command:


This will setup the slave to talk to the Master and do it’s thing. While we are here, we might as well verify that the repl user can log into the master from the slave:

mysql -h -u repl -p

should prompt you for password and if you type in the ‘slavepass’ you assigned above, you should be able to get in.

– Back on the master unlock the tables:


– Last but not least on the slave, turn on the slave mode:


Done…..Now you can go to your production server and suck it’s brains (ahemm…..DB’s) out and import it into your master. Your slave should follow and replicate whatever you import into the master Server. I used the following command (you mileage might/will vary):

mysqldump -x -c --add-drop-table --add-drop-database -u root -p --databases dbname1 dbname2 dbname3 >goodies.sql

Transfer “goodies.sql” text file from your production server to the master server (ssh/scp/ftp….whatever).

mysql -u root -p < goodies.sql

Okay so this only works in Boot Camp 3.0+ which comes with Snow Leopard (10.6). If you ever find yourself in Windows and need to quickly — using command line — change your boot option to reboot into OSX (process known under OSX as blessing) you can use the following command:
c:\progra~1\Bootca~1\bootcamp.exe -StartupDisk "Mac OS" Shutdown /r /t 0
This will reboot your windows session and boot the machine back using the Volume named “Mac OS”. If you omitt -StartupDisk option, then the system will boot into the first Mac OS X volume located by BootCamp.exe. Done :-)

Forcing 64-bit mode when booting OSX 10.6 (Snow Leopard)…

datePosted on 11:36, August 5th, 2010 by Many Ayromlou

You all probably know about the trick with holding down 6 and 4 keys on your keyboard to force OSX 10.6 to boot using the 64-bit kernel. What you might not know is that it’s temporary and the next time you reboot, you’re back to using the 32 bit kernel. Now I can’t guarantee that your machine will not catch fire and blow up (just kidding)…..but if you know what you’re doing and want to have 64-bit kernel goodness all the time you can do the following:
sudo vi /Library/Preferences/SystemConfiguration/ the file to make it look like this:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>Kernel Flags</key>
basically add “arch=x86_64” (without the quotes) to the line that reads<string></string>
That’s it….reboot and enjoy Full 64-bitness….to undo this (if something breaks), edit the file and make it look like this:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<key>Kernel Flags</key>
Save and reboot and you’re back to stock Snow Leopard. The way you check for this — running 32 or 64-bit kernel and extensions — is to run System Profiler (Apple Menu/About This Mac/More Info…) and check the software tab. If you’re in 64-bit mode you’ll find “yes” as the value of “64-bit Kernel and Extensions” entry.

Where is php.ini under OSX 10.5 (Leopard)…

datePosted on 11:24, August 5th, 2010 by Many Ayromlou

I came across a issue and the solution required a bit of tweaking in php.ini. After looking around my Leopard Server I finally found php.ini.default under /etc directory. After making the changes and restarting apache, I got nothing, zip, zilch. Well after digging around the output of phpinfo
phpinfo ();

I found that /etc is the expected location of php.ini. So after copying php.ini.default to php.ini and restarting apache everything started working nicely. Lesson learned….By default the php module uses baked-in values, if you need to change something (eg: maximum upload file size) you need to copy php.ini.default to php.ini (in /etc directory). Make the changes to php.ini and restart apache.

Screen Sharing on mac the easy way……

datePosted on 12:01, March 18th, 2010 by Many Ayromlou

Well, you learn something new everyday. I was always under the impression that you needed Apple Remote Desktop application to connect to a mac that was sharing it’s screen (or vncviewer app). Today I stumbled across another way of doing this without any of these apps……just using the build in “Screen Sharing” application. The easy way (and how I stumbled across this) was to open up Finder/Go/Connect to Server menu option (Apple-K) and type vnc:// in the “server address” field. This is something that works nicely under Linux (gnome desktop) and I always wanted it in mac……well it was there all along…..

And for the command-line junkies there is a even easier way. Open up terminal and type the following command to connect to the remote server:
open vnc://

NICE :-)

The man behind the Mac Chime…….

datePosted on 11:16, March 18th, 2010 by Many Ayromlou

Really cool video of Jim Reekes talking about his thought process in designing sounds for the mac, including the big fat C major chord which your mac plays every time you start it. Jim Reekes was a programmer at Apple Computer for 12 years. His work has significantly affected operating systems, most notably System 7 and QuickTime. He also is responsible for creating many of the system sounds for the Macintosh operating system. Some of the most famous creations during that time were the Mac startup sound and the system sound sosumi. Full 1 hour video can be seen on Youtube.

How to stream live HDV/DV to iphone…..

datePosted on 13:36, March 5th, 2010 by Many Ayromlou

In this guide I’ll show you how to stream live HDV/DV video to your iphone using a linux box (Ubuntu 9.10) with firewire input running vlc/ffmpeg and a Imac with OSX 10.6.2 running mediastreamsegmenter and apache2.

Start out with the iPhone streaming media overview. Without understanding this document you’ll have a hard time getting things working.

First things first, you need to have a working Ubuntu 9.10 machine. I’m using a small footprint 2.4Ghz Core2Duo machine with PCI firewire 400 card in it. For video input I’m using a Canon HV30 set to HDV mode (1080i/60) connected via firewire.

Next you need to follow the instructions on this page (steps 0-5) to get a working ffmpeg with x264 and aac encoding. Without this working you’re not going anywhere….sorry. If you’re trying this on a different Ubuntu installation follow the other links to get a working ffmpeg setup.

Then install vlc using “sudo apt-get install vlc“. I used vlc as my encoder frontend as I understand it better than ffmpeg. You can use just straight ffmpeg as well if you can figure out how to get it to encode the live HDV stream over firewire.

You’ll also need dvgrab utility. Install it using “sudo apt-get install dvgrab“.

Now we want to make sure the internal firewire module is working so type this command and see if you get a vlc window with the camera output in it (make sure you turn the camera ON and hook it up first).
sudo dvgrab -f hdv -noavc -nostop -|vlc -
You have to use sudo under ubuntu to get proper access to the firewire device. The above command runs dvgrab with hdv format and makes sure that 1394 AV/Device control is turned off (this way you can be in Camera mode and get a live feed). The nostop switch prevents dvgrab from sending stop commands to the camera everytime you stop it via Ctrl-C, which I though was a good thing. The last dash forces dvgrab to output to stdout, which we’ll then pipe into vlc (the dash for vlc tells it to use stdin as input).

Next we need to create a media stream out of our linux box and ship it over UDP to the Imac. The vlc command below gets the job done. Remember you’re sudo’ing and need to provide the password after you enter the command.
sudo dvgrab -f hdv -noavc -nostop -|vlc - --sout '#transcode{vcodec=h264,vb=256,venc=x264{aud,profile=baseline,level=30,keyint=30,bframes=0,ref=1,nocabac},acodec=mp4a,ab=64,scale=0.25,deinterlace,width=320,height=240}:duplicate{dst=std{access=udp,mux=ts,dst=}}'
The IP address toward the end of the command is the IP of the Imac machine receiving the stream. Port 1234 is arbitrary. The stream is comprised of h.264 video @ 256K and AAC audio @ 64K. Those elementary streams are then packaged in mpeg2 transport stream before being shipped to the Imac. This is the standard way of doing HTML5 video (from what I understand).

So now we can go over to the mac and see if we receive the video stream. For that just run VLC for OSX and open UDP network port on port 1234 (udp://). If things are working nicely you should see a 320×240 video from you HDV camera on the Imac.

Now that we have the video on the mac, we need to use the “mediastreamsegmenter” command line tool to create HTML5 video stream out of it. mediastreamsegmenter listens on a UDP port for incoming transport stream chops it (by default) into 10 sec. “mini” transport stream files and writes these mini files to wherever you tell it. This location is important since it needs to be accessible to your webserver. Remember, at the end of the chain (day), the webserver is doing all the heavy lifting of delivering the mini transport stream files to your iphone. mediastreamsegmenter also produces a file of type .m3u8
which is basically a live updated playlist.

Something you might not know is that apple ships standard OSX with apache builtin. All you have to do is use the following command to get it started.
apachectl start
Now point your browser on the mac to localhost and see if it loads a page. Now that apache is working we need to modify it so it knows how to deal with .ts and .m3u8 files. This involves adding a couple of lines to /etc/apache2/httpd.conf
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts

and /etc/apache2/mime.types
.m3u8 application/x-mpegURL
.ts video/MP2T

Next we need to restart apache
apachectl restart
By default OSX apache is setup to load it’s documents from /Library/WebServer/Documents, so I created a directory called “stream” to contain the media stuff (.ts files and .m3u8 file) and put the following into the index.html file in /Library/WebServer/Documents.
<title>Video Test</title>
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<body style="background-color:#FFFFFF; ">
<video width='320' height='240' src="prog_index.m3u8" controls autoplay> </video>

Now that we’ve got all the prep done on the mac, we issue the following command from terminal window to get the mediastreamsegmenter going (details can be found by using man mediastreamsegmenter).
mediastreamsegmenter -b -f /Library/WebServer/Documents/stream
Here -b specifies the base of the URL that will be encoded into the .m3u8 file (this is the IP address of your Imac, stream is the folder in /Library/WebServer/Documents/ where the mini .ts files and the .m3u8 file are). The -f switch specifies the output directory for the mini .ts files and the .m3u8 file. and the last IP address:port is from your Linux box.

Now you should be able to open up your browser on your iphone/ipod touch and punch in (assuming the Imac is reachable from your phone) and see the streaming video (You might have to turn on “Plugins” feature under settings/safari on your device. Mine was turned off and drove me crazy until I figured it out). If Plugins is turned off, the index.html page will load, but no video.

Hopefully there is enough meat here to get you guys started……btw. I hear the following command (or variations of) can be used on linux side (instead of vlc). I haven’t tried it and can’t confirm if it works.
ffmpeg -i <in file> -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4×4+partp8×8+partb8×8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 <output file>

Some excellent information can be found on Carson McDonald’s blog:

iPhone Explorer turns your iPhone/iTouch into a USB stick…..

datePosted on 19:53, February 11th, 2010 by Many Ayromlou

One of the original reasons I bought my first ipod (first gen 5 Gig) was that I could hook it up to my mac and use it as a firewire drive. I could literally run around with this in my pocket and boot OSX off the ipod. Well that came to an end with the intro of iPhone/iTouch. Apple took the “disk mode” out. Well that was then, go grab a FREE copy of iPhone explorer and all that USB stick functionality can be your again. Oh, and did I say there is no need for Jail Break either :-)


  • 100% Free iPhone browser for Mac and Windows
  • 100% Drag-and-drop interface for easily copying files to and from your iPhone
  • Create, delete and rename files and folders on your iPhone or iPod Touch
  • Works with all iPhones and iPod Touches including the iPhone 3G and iPod Touch 2G
  • Allows you to use your iPhone as a flash drive / pen drive or put your iPhone into disk mode
  • Tiny download size
  • (Optional) If you jailbreak your iPhone you can access the real root of your iPhone and recover your address book, SMS, e-mails and more.