« Earlier 20 items total Later »

On this page: 

Get packet information on OS X

ipconfig getpacket en0


According to the manual page for ipconfig, this command appears to be unique to Mac OS X.

The command will display a bunch of useful info, including:

server_identifier (ip): That's your DHCP server's IP address.
yiaddr: Your machine's IP address.
chaddr: Your machine's MAC address.
domain_name_server: Your domain name server(s).

Install Rails/lighttpd with DarwinPorts for Tiger

install darwinports package

Add 'export PATH=/opt/local/bin:$PATH' to ~/.bashrc

sudo port -d selfupdate

sudo port install ruby

sudo port install rb-rubygems

sudo gem install rails --include-dependencies

sudo port install readline

sudo port install lighttpd

vi /opt/local/etc/lighttpd.conf [edit lighttpd.conf to your liking]

set up launchd item for lighttpd
        -- restart lighttpd: sudo launchctl stop net.lighttpd
                             sudo launchctl start net.lighttpd

sudo port install fcgi

sudo port install rb-fcgi
         
install official OS X MySQL package (not darwinports)

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql


Links:
darwinports package
launchd item
OS X MySQL package

Mount and install OS X packages from the command line

If you need to install a .pkg application wrapped in a .dmg file from the command line (say, if you only have SSH access to the machine) there are a few command line utilities that will let you do this. For instance, let's say you're trying to install DarwinPorts on a remote OS X box.

cd ~/Desktop

curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-1.2-10.4.dmg

hdiutil attach DarwinPorts-1.2-10.4.dmg

cd /Volumes/DarwinPorts-1.2/

sudo installer -pkg DarwinPorts-1.2.pkg -target "/"

hditutil detach /Volumes/DarwinPorts-1.2/


In a nutshell, this 1) goes to your Desktop folder 2) grabs DarwinPorts from the opendarwin site 3) mounts the dmg 4) goes to the newly mounted DarwinPorts volume 5) installs the package, targeted to the root, as the root user 6) ejects the mounted disc image.

Reindex Spotlight

1. Open Terminal (in /Applications/Utilities/)

2. Type the following:

sudo mdutil -E / to reindex the root volume
sudo mdutil -E /Volumes/volumename to reindex another volume named volumename.

3. Enter your admin password when prompted to do so and press enter.

4. You will receive the message “Volume index removed. Index will be rebuilt automatically.” in the Terminal window. You can monitor the reindexing progress in the Spotlight toolbar drop-down window.

5. Done

Perform System Housekeeping on portable macs

I say on portable mac's because if you have a desktop that never gets shut off, these run automatically.

sudo periodic daily weekly monthly

svnserve launchd item for OS X 10.4

It's not that straightforward getting svnserve to work under launchd. I can't take the credit for this but I thought it would be useful to have it here on TextSnippets.

1) Install subversion if you don't have it already. Here's how with DarwinPorts.

sudo port install subversion


2) Create your Subversion repository (for my own use, I used /Users/xyz/Repositories) e.g.

svnadmin create /Users/xyz/Repositories


3) Place the following XML into a file named org.tigris.subversion.svnserve in the /Library/LaunchDaemons directory.





        Debug
        
        GroupName
        xyz
        Label
        org.tigris.subversion.svnserve
        OnDemand
        
        Program
        /opt/local/bin/svnserve
        ProgramArguments
        
                svnserve
                --inetd
                --root=/Users/xyz/Repositories
        
        ServiceDescription
        SVN Version Control System
        Sockets
        
                Listeners
                
                        SockFamily
                        IPv4
                        SockServiceName
                        svn
                        SockType
                        stream
                
        
        Umask
        2
        UserName
        xyz
        inetdCompatibility
        
                Wait
                
        




You'll need to change xyz to your user name ...

4) Test it out by doing a

sudo launchctl load /Library/LaunchDaemons/org.tigris.subversion.svnserve

sudo launchctl start /Library/LaunchDaemons/org.tigris.subversion.svnserve

svn co svn://your.host.name/aModule/In/Your/Repository

Rails MySQL Session Sweeper

1) Download the launchd GUI, Lingon, from: http://lingon.sourceforge.net/

2) Add hourly job:

$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'


3) My launchd task plist file (yours will vary):





        Label
        us.boygeni.mysql-session-sweeper
        LowPriorityIO
        
        ProgramArguments
        
                /users/defeated/Sites/rails_apps/boygenius/script/runner
                'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'
        
        RunAtLoad
        
        StartInterval
        3600


Mute Remote Macintosh

Sometimes I am in bed and too lazy to get out to mute my G5. I can just grab my iBook, SSH into the G5 and run the following command:

osascript -e 'set volume output muted true'


brilliant!

Enable arrow keys in python interpreter in OS X

Something that has always bothered me is that in OS X's default python install, typing an arrow enters the escape sequence # ex: [^[[A, ^[[D]; instead of moving the cursor or going to the previous commands. To solve this issue, one needs to install the readline module.

From Bob Ippolito:
In the terminal, enter:
python `python -c “import pimp; print pimp.__file__”` -i readline

----
This works with the standard installation of python 2.3 included with OS X. I have not yet gotten readline to work with python 2.4.2.

Defeat Apple's Anti-DVD-Screenshot DRM

Apple disables the OS X screenshot capability while a DVD is playing, but there is a workaround.

Using terminal, type in this command.
screencapture -i ~/Desktop/filename.jpg


Your mouse should turn into crosshairs. Now hit the space bar. Your mouse should now be a camera. Click the window the DVD is playing in. A file called "filename.jpg" will appear on your desktop.

Found here with many more options:
http://highschoolblows.blogspot.com/2005/11/take-screenshot-of-dvd-player-in-os-x.html

« Earlier 20 items total Later »