Feb 21

To reset your OS X password without an OS X CD you have two ways

First Way “create a new admin account”

  1. Reboot
  2. Hold apple + s down after you hear the chime.
  3. When you get text prompt enter in these terminal commands to create a brand new admin account (hitting return after each line):
    • mount -uw /
    • rm /var/db/.AppleSetupDone
    • shutdown -h now
  4. After rebooting you should have a brand new admin account. When you login as the new admin you can simply delete the old one and you’re good to go again!

Second way “Resetting or changing your existing password”

If you’ve ever forgotten your user account password in OS X, All you need is to remember your username (you do remember that, right?) and then reboot your computer.

  1. Hold apple + s down after you hear the chime.
  2. sh /etc/rc
  3. passwd yourusername
  4. reboot

P.S. The only major downside to resetting your password this way is that you’ll lose all keychain passwords,

tags: password, security

Dec 22

vim vi snow leopardThe default vim is  pretty bland and unimpressive. I would share a few of the settings I have found or plundered from Linux installations in order to make vim more usable.

This can go in your .vimrc or in a global location such as /usr/share/vim/vimrc.
I would be interested in what other command line and vim users do to improve Snow Leopard.

step 1. Add following code to /usr/share/vim/vimrc

set nocompatible " Use Vim defaults
set bs=2 " backspacing over everything in insert mode
set ai " Auto indenting
set history=100 " keep 100 lines of history
set ruler " show the cursor position

set viminfo='20,\"200 " keep a .viminfo file

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

step 2. Make alias vi = vim

open ~/.bash_profile and add following code

alias vi=vim
tags: syntax, vim

Dec 10

You may never need this, but if you administer servers remotely via the built in Apple VNC, it is the best trick ever.

However, the VNC service occasionally crashes, and locks my session. It also refuses any more VNC logins. This is particularly frustrating when I am off site! Apple has analyzed this and has no explanation or fix.

Here solution howto fix it: If SSH access is enabled on the server, you can connect to the server via an SSH client  and run this command:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent

You must log in with admin rights, and must enter the admin password again to run the command. It can take a minute to run. After it finishes you’ll able to login again via VNC.
macosx-vnc

You can play with remotely once you kickstart ARD
http://support.apple.com/kb/HT2370?viewlocale=en_US

tags: crash, ssh, vnc

Nov 04

basndwidth-throttleAdvanced OS X users know that Darwin comes with ipfw, which can be used to set up a custom firewall. IPFW’s flexibility, very targeted bandwidth limiting rules can be made in only a few lines. This same service however can be used to also limit bandwidth on specific ports.

The following ipfw rules will limit connections from Mac to ISP’s mail server to 100K per second only for outgoing smtp connections:

sudo ipfw pipe 1 config bw 100Kbit/s
sudo ipfw pipe 1 tcp from me to smtp.west.cox.net 25

Obviously, the rate can be tailored to anything you like, and the rule is specific enough not to get in the way of any other connections going on.
to remove the pipe from the port

sudo ipfw delete 1

Another example could be for webdevelopers

You should see how long it takes modern sites to load on 56k…

Create a pipe that only allows up to 15KB/s

sudo ipfw pipe 1 config bw 15KByte/s

Attach that pipe to the outgoing traffic on port 80

sudo ipfw add 1 pipe 1 src-port 80

Delete the pipe when finished

sudo ipfw delete 1
tags: net

Oct 28

A dark scary place full of text. That’s how it feels at first anyway. This is a selection of Terminal Commands that I have found particularly useful. Change settings for Spaces, Spotlight, Dock, Finder, Time Machine, System, etc that aren’t accessible through the application or system preferences. If you are just making your first forays into OS X Terminal land hopefully they will help you out.

Here are some very useful terminal commands and tips for hidden Mac OS X settings.

All subjects

tags: configuration, preferences, Terminal

Oct 18

exposeIn 10.6 that when use Exposé in Application Windows mode, it shows  all windows, not just the ones in the current Space. I always end up clicking on the wrong window and being whisked away to a another Space.

To stop that from happening, open Terminal and run these two commands:

defaults write com.apple.dock wvous-show-windows-in-other-spaces -bool FALSE
killall Dock

From now on, Exposés Application Windows mode will only show windows in the current Space.

To reverse this hint, use

defaults delete com.apple.dock wvous-show-windows-in-other-spaces
killall Dock

Source: mymacosx

tags: expose, space

Oct 01

Snow Leopard’s Terminal has a new very useful feature “SPLIT” / “COLLAPSE” as in many text editors. Check out the split/collapse window buttons here above the scroll bar:

split terminal button

Click the top “split” button or press Command+D shortcut and now you’ve got your window split into two usable panes like so:
Split Window layoutTo collapse the window press Command+Shift+D

ALso, you can do multiple splits. Aside from general speed increase I think split pane in Terminal is my new favorite feature.

See the Terminal Splits Windows Movie:
You need to a flashplayer enabled browser to view this YouTube video

tags: short keys, Snow Leopard, Terminal, Text Editor