Archive for the ‘osX’ Category.

Mac OSX Split files greater then 2Gb

Just discovered that split (version 1.6) on Mac OS X Version 10.4.8 (PPC) does not handle files greater than 2Gb.

I’ve found two work arounds to this problem, the first is the one I typically do, but it requires darwin ports to be installed, I happen to have this installed everywhere anyway.

Darwin Ports

Simply ‘port install coreutils’:

% port search coreutils
coreutils                      sysutils/coreutils 5.97         GNU File, Shell, and Text utilities
% sudo port install coreutils
Password:
--->  Fetching coreutils
--->  Attempting to fetch coreutils-5.97.tar.bz2 from ftp://ftp.gnu.org/gnu/coreutils
--->  Verifying checksum(s) for coreutils
--->  Extracting coreutils
--->  Configuring coreutils
--->  Building coreutils with target all
--->  Staging coreutils into destroot
--->  Installing coreutils 5.97_0
--->  Activating coreutils 5.97_0
--->  Cleaning coreutils
%

Thats it, the only caveat is the new GNU split is named gsplit. So remember to type that when you want to split files over 2Gb!

Compile from source

The second method was found here. I like to keep things in my own logbook so I’ve put a copy of the instructions below

  1. Download the latest NetBSD split source from here
  2. Add the following somewhere near the top:
    #include
    
  3. Compile with either:

    For your architecture:

    cc -Os -o split split.c
    

    Or a Universal binary:

    cc -Os -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc -o split split.c
    
  4. Copy the binary in place:
    $ sudo mv /usr/bin/split /usr/bin/split.apple
    $ sudo cp split /usr/bin/split
    $ sudo chmod ugo-w /usr/bin/split
    $ sudo chmod ugo+rx /usr/bin/split
    $ sudo chown root:wheel /usr/bin/split
    

Adjusting prefs from the command line

To adjust the various system preferences from the command line you need the systemsetup utility which ships with OSX Server although I’ve found some versions of OS X client have it installed in /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support. On my G5 with Tiger (10.4.8) installed I used systemsetup-tiger and on my iMac (Intel) that was missing so I used systemsetup-panther which also worked.

You can adjust all sorts of things with the tool -help shows you all the options, I wanted to adjust sleep times. Below is an example session, showing the settings before and after I had made the change

# ./systemsetup-panther -getsleep
Sleep: Computer sleeps after 10 minutes
Sleep: Display sleeps after 10 minutes
Sleep: Disk sleeps after 10 minutes
# sudo ./systemsetup-panther -setcomputersleep 60
setcomputersleep: 60
# ./systemsetup-panther -getsleep
Sleep: Computer sleeps after 60 minutes
Sleep: Display sleeps after 10 minutes
Sleep: Disk sleeps after 10 minutes

remote access command line tips

Mac OSX ntp

If you want to sync to a time server other than the default apple provided ones you can enter the address into the box in the ‘Date & Time’ preference pane. To enter multiple servers seperate them with spaces as show in the image below. All this actually does is write the information out to /etc/ntp.conf and restarts the ntp daemon. Remember that the file will get overwritten when you access the preference pane though.

osx_ntp

Configuring multiple DNS domains

Okay suppose you are on a corporate LAN and VPN’d into some other private network. You want DNS to resolve the local intranet, but also resolve your VPN’d LAN. If you VPN’d LAN domain is internal.sollicker.com then create;

/etc/resolver/sollicker.com

and in this file;

search internal.sollicker.com sollicker.com
nameserver 172.16.100.15

Then run:

sudo kill -HUP `cat /var/run/lookupd.pid`

Moving the /Users directory

Recently I needed to move the /Users tree onto another partition on a OS X machine at work, I found this great howto.

Making iDVD use an external dvd writer

I recently bought one of these fantastic Lacie drives. The problem is that iDVD will not let me write to anything other than a superdrive. Then I found this thread. Download the file from there (mirrored here) extract the archive and place the 2 files in your home account. Control click on either the burn dvd button or the burn dvd menu item and it should present you with a list of dvd writers attached to the machine, or the option of writing to a img file.

OS X filesystem case insensitivity problems

I’m using os X (10.3.3) to serve images via apache here and have just been bitten by the lack of case sensitivity on the filesystem. I had a LocationMatch block in httpd.conf which was not as secure as I expected:

<LocationMatch "/.*/hires/.*">
<Limit GET>
Satisfy any
Order deny,allow
Deny from all
Allow from XX.XX.XX.XX
</Limit>
</LocationMatch>

This was obviously meant to stop access to a hires directory, however because of the lack of case sensitivity if you tried to grab the same url but with HIRES instead it would fail to match this regex but it would still match the hires directory. To fix this I have changed the regex to:

<LocationMatch "/.*/(H|h)(I|i)(R|r)(E|e)(S|s)/.*">
<Limit GET>
Satisfy any
Order deny,allow
Deny from all
Allow from XX.XX.XX.XX
</Limit>
</LocationMatch>

Lookupd

while trying to fix lookupd hanging I found this little page which explains some stuff about how to change the order etc.

Useful command line tools

For admining OS X, here