This is the script I’m using when I start my local Rails development server. It will automatically detect the next available port starting at the default port 3000 so I can have multiple servers running without remembering what ports that are already busy. #!/usr/bin/env ruby DEFAULT_PORT = 3000 puts (`ps aux | grep [r]uby | grep script/server`.split(”\n”).map { [...]