News for hackers. Stuff that matters.

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

I don't know how I have lived without it for so long: http://www.decimus.net/dterm.php

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.

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.

( 58 comments | 108 points | on HN )
Re:Tell HN: Best OS X Utility for programmers who use the co... by andrewtj on Sunday February 28, 2010 @10:34PM (#1157986)
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:]) }))" $@
  }
Re:Tell HN: Best OS X Utility for programmers who use the co... by aschobel on Sunday February 28, 2010 @11:44PM (#1158068)
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

Re:Tell HN: Best OS X Utility for programmers who use the co... by weaksauce on Sunday February 28, 2010 @10:58PM (#1158013)
That's not really flippant as those are useful by themselves. All the utility I am advocating does it make the oneliners a bit easier to get to and have context(i.e. changing the working directory to what you are actually working on) readily available. I would say that a programmer without a decent list of aliases saved up is not the best programmer.
Re:Tell HN: Best OS X Utility for programmers who use the co... by po on Sunday February 28, 2010 @10:38PM (#1157991)
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.

Re:Tell HN: Best OS X Utility for programmers who use the co... by KC8ZKF on Sunday February 28, 2010 @11:56PM (#1158083)
There is something written on the linked page that has always bothered me: "Using sudo all the time is annoying, but far worse — it conditions you to type in your root password without thinking about it." That quote implies a misunderstanding of sudo, and has made me less confident about installing Homebrew. Unix permissions and installation procedures should be well understood by a developer of package management software.

It's probably good software, for all that. He probably understands Unix better than I do, but it still bothers me.

Re:Tell HN: Best OS X Utility for programmers who use the co... by tvon on Monday March 01, 2010 @12:13PM (#1159154)
The author (of Homebrew) is well intentioned but I've gotten a few hints that he doesn't really come from a *nix background (the /usr/local thing, the aggressive Gentoo-esque "optimization", etc).
Re:Tell HN: Best OS X Utility for programmers who use the co... by tvon on Monday March 01, 2010 @12:06PM (#1159133)
[edit: http://news.ycombinator.com/item?id=872072 for some clarification on a few Homebrew vs MacPorts misconceptions.]

I used Homebrew for a bit, even submitted some recipes, but I've since switched back to MacPorts, in short because:

* MacPorts was once as simple as Homebrew, it's not now for good reasons. Eg, the reason MacPorts uses it's own python is beucase Apple is slow to update their own python, and when they do it happens outside of your own setup so you won't necessarily know you need to rebuild X, Y and Z.

* Homebrew did some silly things like aggressive stripping (which seemed to just be commands pulled from the Gentoo wiki without any real justification) which caused problems a few times when I tried to install things outside of Homebrew (eg, easy_install of MySQLdb didn't work out-of-the-box with the Homebrew mysql libs).

Re:Tell HN: Best OS X Utility for programmers who use the co... by jmatt on Sunday February 28, 2010 @11:56PM (#1158084)
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.
Re:Tell HN: Best OS X Utility for programmers who use the co... by illumin8 on Monday March 01, 2010 @12:06AM (#1158093)
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?

Re:Tell HN: Best OS X Utility for programmers who use the co... by joevandyk on Monday March 01, 2010 @02:15AM (#1158235)
Why would stuff about a particular OS's filesytem be taught in a beginning computer science class?
Re:Tell HN: Best OS X Utility for programmers who use the co... by nvoorhies on Monday March 01, 2010 @03:26AM (#1158338)
It's akin to "here's where the computer lab is" rather than in the "this is what a stack is"
Re:Tell HN: Best OS X Utility for programmers who use the co... by illumin8 on Thursday March 04, 2010 @08:17PM (#1168543)
Because CS101 should teach you about basic programming techniques, like how to open a file for reading or writing. In order to understand how to open a file, you need to have a basic understanding of how permissions work. In order to understand how permissions work, you need to understand how mode bits work.

This is really basic stuff, but I'm not surprised that most developers think it is beneath them. "That's sysadmin stuff; I don't need to learn that." These are usually the same developers that think chmod 777 is a fix.

Re:Tell HN: Best OS X Utility for programmers who use the co... by olliesaunders on Monday March 01, 2010 @07:19AM (#1158560)
I don't get why this is bad. The stuff in /usr/local is supposed to belong all to me unless I have to share my computer with other users and then I guess I'd use a group. I also like the point the brew README makes about how using sudo a lot conditions you to use it without thinking.
Re:Tell HN: Best OS X Utility for programmers who use the co... by fragmede on Monday March 01, 2010 @02:18AM (#1158242)
Uh, so don't do that. On my macbook, I stuck homebrew in ~/homebrew and everything is great.
Re:Tell HN: Best OS X Utility for programmers who use the co... by tvon on Monday March 01, 2010 @12:11PM (#1159150)
I think the point is more that the general instructions tell you to do it without any justification (which a lot of experienced *nix users seem to think it needs, myself included), it makes you wonder what kind of code is sitting in there without real justification.
Re:Tell HN: Best OS X Utility for programmers who use the co... by dasil003 on Sunday February 28, 2010 @10:55PM (#1158010)
I'm just waiting to get a new MBP to setup everything via homebrew. Building myself vs choosing MacPorts has never been an easy choice. Inevitably over the years the choice one way or another has caused me a lot of pain. Homebrew seems to be the best of both worlds, and allows you to confine everything to your home directory which is a nice bonus in my case.

My only fear with homebrew is the lack of robust dependency resolution, but in practice I tend to be installing a limited set of devtools, so it doesn't rise to the same dependency hell that gave rise to the modern crop of unix package managers.

Re:Tell HN: Best OS X Utility for programmers who use the co... by jperras on Sunday February 28, 2010 @11:12PM (#1158030)
I feel like this is a common argument against homebrew, but have yet to encounter a situation where this was actually an issue.
Re:Tell HN: Best OS X Utility for programmers who use the co... by PatrickTulskie on Sunday February 28, 2010 @11:59PM (#1158087)
I've found that the dependancy resolution is pretty decent. Heck, it can install ImageMagick just fine.
Re:Tell HN: Best OS X Utility for programmers who use the co... by mseebach on Monday March 01, 2010 @02:35AM (#1158262)
Why isn't there a binary package system, like apt, for OSX?
Re:Tell HN: Best OS X Utility for programmers who use the co... by jeremyswank on Monday March 01, 2010 @04:01AM (#1158383)
Re:Tell HN: Best OS X Utility for programmers who use the co... by tvon on Monday March 01, 2010 @12:34PM (#1159211)
There is also [the possibly out of date?] Rudix (http://rudix.org/), which is basically standard OSX packages (.pkg) of typical unix tools. Their summary:

> Rudix features a world class collection of pre-compiled and ready to use Unix compatible software which are not available from a fresh installation of Mac OS X but are popular among other Unix environments. Here you can find utilities, programming languages, libraries and tools delivered as standard Mac OS X packages.

I haven't used this, though it may appeal to some.

Re:Tell HN: Best OS X Utility for programmers who use the co... by mseebach on Monday March 01, 2010 @05:13AM (#1158448)
MacPorts isn't binary. I didn't know Fink was, but that's cool, and I'm switching right away.
Re:Tell HN: Best OS X Utility for programmers who use the co... by olliesaunders on Monday March 01, 2010 @07:10AM (#1158547)
"Dependency resolution and updates are basic or not working yet."
Re:Tell HN: Best OS X Utility for programmers who use the co... by mgrouchy on Sunday February 28, 2010 @09:47PM (#1157931)
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.
Re:Tell HN: Best OS X Utility for programmers who use the co... by woid on Sunday February 28, 2010 @10:48PM (#1158002)
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 ...
Re:Tell HN: Best OS X Utility for programmers who use the co... by tvon on Sunday February 28, 2010 @10:25PM (#1157975)
Huge visor fan, couldn't live without it. I have a fullscreen terminal a control-tilde away at all times.
Re:Tell HN: Best OS X Utility for programmers who use the co... by joeyo on Monday March 01, 2010 @01:00AM (#1158164)
Thanks for that link! I hadn't realized the source had forked away from the Blacktree original and now I find I am running a rather old version of visor.
Re:Tell HN: Best OS X Utility for programmers who use the co... by weaksauce on Sunday February 28, 2010 @09:53PM (#1157938)
I like that tool too. I could see them being complementary.
Re:Tell HN: Best OS X Utility for programmers who use the co... by moe on Sunday February 28, 2010 @10:23PM (#1157971)
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).

Re:Tell HN: Best OS X Utility for programmers who use the co... by dhess on Sunday February 28, 2010 @10:31PM (#1157982)
Is Butler being maintained? Is there a bug tracker? It doesn't look like there's been a release since 2008, but I can't tell because I can't find a dated changelog for the project.
Re:Tell HN: Best OS X Utility for programmers who use the co... by vl on Sunday February 28, 2010 @11:43PM (#1158064)
I use Butler to remap Home and End keys to have PC-like behavior. Can't live without it!
Re:Tell HN: Best OS X Utility for programmers who use the co... by ube on Monday March 01, 2010 @03:01AM (#1158309)
Does your mapping work well across most/all applications? I've tried mapping via keybindings file and messed up my account (this is snowlepord)
Re:Tell HN: Best OS X Utility for programmers who use the co... by vl on Tuesday March 02, 2010 @02:42AM (#1160830)
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.

Re:Tell HN: Best OS X Utility for programmers who use the co... by nudded on Monday March 01, 2010 @03:00AM (#1158307)
command + (left|right) arrow would do the same on a mac.
Re:Tell HN: Best OS X Utility for programmers who use the co... by vl on Tuesday March 02, 2010 @02:44AM (#1160835)
This is exactly what Home and End are remapped to.
Re:Tell HN: Best OS X Utility for programmers who use the co... by weaksauce on Sunday February 28, 2010 @08:41PM (#1157865)
Re:Tell HN: Best OS X Utility for programmers who use the co... by icodestuff on Monday March 01, 2010 @03:46AM (#1158369)
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...

Re:Tell HN: Best OS X Utility for programmers who use the co... by aeontech on Sunday February 28, 2010 @10:36PM (#1157989)
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).
Re:Tell HN: Best OS X Utility for programmers who use the co... by phren0logy on Sunday February 28, 2010 @10:50PM (#1158005)
http://www.macupdate.com/info.php/id/14831/quicksilver

The "stealth" release of QuickSilver beta 57, from November 2009. It's not perfect, but it crashes far less than other builds in 10.6.2 (for me at least).

I have no idea why it's not on the blacktree site.

Re:Tell HN: Best OS X Utility for programmers who use the co... by junklight on Monday March 01, 2010 @05:49AM (#1158478)
I'd given up on QS and gone to google search box (or whatever it was called) - I happily am back on QS with this stealth release - much faster and don't remember the last time it crashed
Re:Tell HN: Best OS X Utility for programmers who use the co... by weaksauce on Sunday February 28, 2010 @10:51PM (#1158007)
I am a quicksilver user too. Though the index updating seemed to beachball my computer on the regular. After changing the prefs to only update once a day they have gone away.
Re:Tell HN: Best OS X Utility for programmers who use the co... by ctcherry on Sunday February 28, 2010 @11:02PM (#1158016)
I used to be a quicksilver user, I now use this http://www.google.com/quicksearchbox/ basically the same idea.
Re:Tell HN: Best OS X Utility for programmers who use the co... by nkm on Sunday February 28, 2010 @11:25PM (#1158041)
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.

Re:Tell HN: Best OS X Utility for programmers who use the co... by aeontech on Sunday February 28, 2010 @11:49PM (#1158073)
Yeah I tried it, but it's not as featureful as quicksilver, still. Maybe once it matures a bit.
Re:Tell HN: Best OS X Utility for programmers who use the co... by canadaduane on Sunday February 28, 2010 @10:02PM (#1157948)
I use LaunchBar more than I use the Dock: http://www.obdev.at/products/launchbar/index.html
Re:Tell HN: Best OS X Utility for programmers who use the co... by godDLL on Monday March 01, 2010 @05:49AM (#1158479)
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)\$ '
Re:Tell HN: Best OS X Utility for programmers who use the co... by andrewtj on Monday March 01, 2010 @07:16PM (#1160229)
For anyone interested in having Git, SVN and VirtualEnv status in your prompt: http://pastebin.com/f79a9af51
Re:Tell HN: Best OS X Utility for programmers who use the co... by riffraff on Monday March 01, 2010 @07:22AM (#1158564)
you may like __git_ps1 :)
Re:Tell HN: Best OS X Utility for programmers who use the co... by Dobbs on Sunday February 28, 2010 @10:33PM (#1157983)
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.
Re:Tell HN: Best OS X Utility for programmers who use the co... by dasil003 on Sunday February 28, 2010 @10:50PM (#1158006)
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.
Re:Tell HN: Best OS X Utility for programmers who use the co... by weaksauce on Sunday February 28, 2010 @11:05PM (#1158020)
I must say that the biggest selling point on the mac to me was that it had a POSIX shell readily available and I didn't need "putty" to do anything interesting. I have been and still am responsible for many windows boxes but I cannot stand it for my main machine.

I really love the fact that all the power of UNIX is hidden behind a nice GUI(though there are some things that I would like them to fix regarding finder)

Re:Tell HN: Best OS X Utility for programmers who use the co... by fragmede on Monday March 01, 2010 @02:33AM (#1158257)
Slightly different and finder only: http://code.google.com/p/cdto/

'Open a terminal window here'

Re:Tell HN: Best OS X Utility for programmers who use the co... by wrinklz on Monday March 01, 2010 @02:51AM (#1158288)
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
Re:Tell HN: Best OS X Utility for programmers who use the co... by oldbrownshoe08 on Monday March 01, 2010 @03:34PM (#1159687)
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...

Re:Tell HN: Best OS X Utility for programmers who use the co... by alagu on Monday March 01, 2010 @04:52AM (#1158430)
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.

Re:Tell HN: Best OS X Utility for programmers who use the co... by stevelosh on Monday March 01, 2010 @08:55AM (#1158659)
Rupa's 'z' makes working in a command line so much nicer: http://github.com/rupa/z
Re:Tell HN: Best OS X Utility for programmers who use the co... by Groxx on Monday March 01, 2010 @12:16AM (#1158110)
dterm, eh? That looks awesome... gotta give it a try now.
Re:Tell HN: Best OS X Utility for programmers who use the co... by sabat on Monday March 01, 2010 @12:41AM (#1158136)
Awesome. I can't believe I lived without this.