How to set a Static ip Address in OS X from Command Line

You can set a static ip address in OS X with the following command. Replace en0 with the appropriate interface.

sudo ipconfig set en0 INFORM 192.168.10.12

The default ethernet interface on a Mac is usually en0. You can run ifconfig to view all the interfaces available on the machine.

The ip address will last until you reboot.

How to Reset an OS X Password

You first need to boot your Mac into single user mode by booting it up while holding down the “command+s” keys.

Once your in Single User Mode type in

mount -uw /

That will mount your Mac hard drive. Now run

launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist

and now you can change the password.  Replace “username” and “password” with the username for the user and the new password.

dscl . passwd /Users/username password

Now you can reboot the machine

reboot

and log in with the new password.

How to Install an OS X .pkg file from Command Line

The following command installs the .pkg to the local hard disk.

installer -pkg /Users/username/Desktop/package.pkg -target LocalSystem

You can also replace “LocalSystem with a “/” they both do the same thing.

If you want to install the package on a different disk you can change the -target to the drives path.

installer -pkg package.pkg -target "/Volumes/Macintosh HD2"

You can find more about the command by typing “man installer” in the terminal.