

Tell HN: Best OS X Utility for programmers who use the command line - weaksauce

I don't know how I have lived without it for so long: http://www.decimus.net/dterm.php<p>Fast access to the shell that defaults to the working directory of the currently used file from say xcode and you can paste in the current working file(s) as arguments to whatever you want to run. There is an option to run the command in the overlay app or in terminal.<p>I recently found out about it because I was looking for xcode git integration and this makes accessing the shell git stuff quick. It's free too.
======
andrewtj
I'm going to be slightly flippant and say the the bundled tools and little one
liners built with them. A few examples from my .profile follow:

Eject a volume:

    
    
      alias eject='hdiutil eject'
    

Copy the working dir to the clipboard:

    
    
      alias cpwd='pwd|xargs echo -n|pbcopy'
    

Show current airport status:

    
    
      apinfo='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I'
    
    

Use spotlight to search for a file:

    
    
      spotlightfile() {
          mdfind "kMDItemDisplayName == '$@'wc";
      }
    

Use spotlight to search file contents:

    
    
      spotlightcontent() {
          mdfind -interpret "$@";
      }
    

Display a man page in Preview:

    
    
      pdfman () {
         man -t $1 | open -a /Applications/Preview.app -f
      }
    

I've a few others but they're less generic than the above. Also although the
above were sitting in my .profile I probably yanked them from random parts of
the inter-webs; in other words, I take no credit for them.

EDIT: One more generic one I use fairly regularly:

    
    
      google() {
          python -c "import sys, webbrowser, urllib;   webbrowser.open('http://www.google.com/search?' + urllib.urlencode({'q': ' '.join(sys.argv[1:]) }))" $@
      }

~~~
aschobel
pbcopy is a great little utility

another neat trick is dragging and dropping a file to the terminal and having
the filename pasted to the terminal

------
po
Not really a command line utility, but rather a programming utility used
through the command line:

<http://github.com/mxcl/homebrew>

I've replaced my MacPorts install with Homebrew and have been pretty happy
with it. It's relatively new so not everything is in there yet.

~~~
jmatt
If they didn't have those insane installation instructions that said:

    
    
      sudo chown -R `whoami` /usr/local
    

I'd check this out. But I just can't bring myself to do it when they still
have that as their default install instructions.

~~~
illumin8
A lot of developers have no idea how UNIX permissions and mode bits work. I've
witnessed this countless times, when a developer can't figure out why his code
won't run, and just tells me to "chmod -R 777 /programdir/*"

I've had to sit a few developers down and teach them how to use commands like
strace and truss to show them exactly which file they are trying to f_open and
why it fails (usually trying to open a file in read/write mode that is not
owned by them and 644 permissions).

Shouldn't this stuff be taught in basic CS101 courses?

~~~
joevandyk
Why would stuff about a particular OS's filesytem be taught in a beginning
computer science class?

~~~
nvoorhies
It's akin to "here's where the computer lab is" rather than in the "this is
what a stack is"

------
mgrouchy
pretty cool, a tool I have been using for quite some time that I find
incredible useful is <http://visor.binaryage.com/> . Not quite the same thing,
but still awesome.

~~~
woid
hey I'm also working on TotalFinder. in 0.9 I plan to add Terminal+Finder
cooperation mode: when you press hotkey you may slide both Visor Terminal down
and Visor Finder Up. You may tab between terminal and finder as it would be
one app and their views will stay synced. You get the idea ...

------
moe
That's really awesome, thanks for the link.

One of my best finds so far would be butler:
<http://www.petermaurer.de/butler/>

It's basically quicksilver but with less obscure configuration dialogs and
without the crashes (quicksilver would crash a lot on me).

~~~
vl
I use Butler to remap Home and End keys to have PC-like behavior. Can't live
without it!

~~~
ube
Does your mapping work well across most/all applications? I've tried mapping
via keybindings file and messed up my account (this is snowlepord)

~~~
vl
I had to exclude iTerm (you can exclude apps in Butler), everything else
(Firefox, Eclipse, Parallels, TextWrangler, Thunderbird) works fine.

Obviously, Shift-Home and Shift-End should be remapped as well so selection
would work.

------
weaksauce
Clickable: <http://www.decimus.net/dterm.php>

------
icodestuff
That solves one half of the terminal/GUI interaction disconnect, but I'd
really like something to do the opposite too... keep a Finder window synced to
my current working directory, preferably that floats above everything else* .

Why? There's a few things that you can't do with a Terminal, such as seeing
and easily editing all the info from Get Info at once, or most things
involving the use of a contextual menu - especially seeing what programs are
in the Open With list (there may be a launch services related command, but you
still can't pick one without typing another command (open -a Application
file). Multi-file drag and drop is easier than multi-file cp, especially if
you don't need a particularly named group of files that you can use a wildcard
with - it's easier to shift-click or command-click than to type each one out
individually, even if you can use tab completion.

* aliasing cd to end with an open . won't do, because that brings Finder to the front (which you can work around in bash), along with all the other open Finder windows (which you can't), and worse, it opens a new window every time instead of reusing the same one (another can't work around). The last two are because you can't, as far as I know, get a handle on a particular Finder window. I wonder if an AppleScript can get the job done. Hmm...

------
aeontech
I use quicksilver [<http://github.com/andreberg/blacktree-alchemy/downloads>],
more than anything else. (still like it better than launchbar, even with it
being not updated in a few years).

~~~
ctcherry
I used to be a quicksilver user, I now use this
<http://www.google.com/quicksearchbox/> basically the same idea.

~~~
nkm
Actually, the main developer of QSB is also the creator of Quicksilver, whom
made it an open source project once Google hired him.

That's why Quicksilver has no official site, by the way.

------
canadaduane
I use LaunchBar more than I use the Dock:
<http://www.obdev.at/products/launchbar/index.html>

------
godDLL
DTerm is awesome, and since it went free there is no reason not to try it out
even if you're a Quicksilver/LaunchBar user – you probably will find it serves
you better in many scenarios.

And here's a nice tidbit – TextMate comes with `mate`, a proxy utility you can
call with DTerm like so: `mate ./new_file_here`. But XCode doesn't, and won't
create a file for you if one doesn't exist. So for XCode I have an
function/proxy in my `~/.profile`:

    
    
       function edit { touch "$1"; open -a Xcode "$1"; }
    

Bash can be very usefully augmented, for instance you can have a git repo
status in your prompt, like so:

    
    
       function wgit_dirty {
          git diff --quiet HEAD &>/dev/null
          [[ $? == 1 ]] && echo "◆"
       }
       function wgit_branch {
          REF=$(git symbolic-ref HEAD 2> /dev/null) || return
          echo :${REF#refs/heads/}$(wgit_dirty)
       }
       export PS1='\u \W$(wgit_branch)\$ '

~~~
andrewtj
For anyone interested in having Git, SVN and VirtualEnv status in your prompt:
<http://pastebin.com/f79a9af51>

------
fragmede
Slightly different and finder only: <http://code.google.com/p/cdto/>

'Open a terminal window here'

------
Dobbs
I have to say this tool made me consider getting a mac for a second. Still
wont but it has done more good for the argument than any other I've sen
before.

~~~
dasil003
Interesting. What sold me on OS X almost 10 years ago now was the simple
combination of a first-class UNIX OS w/ support for the major consumer and
professional creative apps.

------
alagu
Not really a commandline tool, but when I am writing code or on terminal I
heavily use MegaZoomer - <http://osx.iusethis.com/app/megazoomer>

Gives total real estate for the terminal (works in other apps too)

DTerm is a great tool.

------
oldbrownshoe08
Semi command line, icalBuddy + GeekTool for displaying calendar items and to
do's on the desktop is awesome.

[http://www.makeuseof.com/tag/how-to-show-ical-tasks-
events-o...](http://www.makeuseof.com/tag/how-to-show-ical-tasks-events-on-
the-desktop-mac-only/)

------
wrinklz
OnMyCommand is a UNIX shell script and AppleScript executor. You can build
your own Contextual Menu Item or GUI application. Sweet.
<http://free.abracode.com/cmworkshop/on_my_command.html>

------
stevelosh
Rupa's 'z' makes working in a command line so much nicer:
<http://github.com/rupa/z>

------
Groxx
dterm, eh? That looks awesome... gotta give it a try now.

------
sabat
Awesome. I can't believe I lived without this.

