Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

161–170 of 243 posts

Re: OS X Command Line Utilities

#161

The biggest change I have found for my terminal was adding this to my .bash_profile: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced I thought that was one of the most amazing things when I used a linux system, but OS X is black and white by default.

`ls -G` will show colors with BSD ls, much like `ls --color' with GNU ls.

Re: OS X Command Line Utilities

#162

Earlier quoted context omitted.

> Go fullscreen. Not so much for the real estate but for the mental switch. Fullscreen mode is a way to immerse yourself into your productive development world. No browser, no mail, no application notification. Only code. This is an excellent point and one that's not nearly as appreciated as it should be. Fullscreen mode was written off in Lion as an example of Apple dumbing down the platform and making it more like…

I wish fullscreen mode didn't switch to a different desktop. Tabbing out causes this weird "whoosh" animation to play which is so annoying.

Check out iTerm2. Full-screen iTerm2 doesn't switch to a different desktop and tabbing to another app is instantaneous.

Re: OS X Command Line Utilities

#163
post #12

/usr/local is the default location for user-installed stuff, but I personally like to have my package manager do its stuff in a separate directory. I like the way Fink [1] uses the /sw (software) directory. Does anyone have a valuable opinion on the comparison between Fink and Homebrew — or maybe MacPorts? [1] http://www.finkproject.org

I agree about staying out of /usr/local. I install stuff there -- I don't want my package manager taking it over. That's kept me away from Homebrew.

It does bother me that Homebrew advocates using /usr/local, that is a choice that needs justification and I don't believe they offer anything convincing.

That said, you can configure homebrew to use any path (check the wiki), you just have to set other environment variables as needed (eg, PATH). For example I'm currently using /opt/homebrew.

(note: a large downside to this is that you have to compile everything and cannot take advantage of Homebrew's pre-compiled "bottles" for some packages)

Re: OS X Command Line Utilities

#164
post #83

The one utility I can't live without is caffeinate, which prevents a Mac from sleeping. It's super useful for keeping long running tasks running.

Why not just disable sleep? I only ever sleep my Macs manually (if ever).

it's useful to be able to switch between the two without having to open up the preferences

Re: OS X Command Line Utilities

#165
post #140
post #104

Earlier quoted context omitted.

When i first found out about pushd and popd, i loved them, and used them all the time. These days, i never use them. The way i work now is that i have a bunch of terminal tabs open. Each tab has a shell which pretty much just sits in a single directory. If i need to switch to a different directory, i switch tabs. A nice effect of this is that each tab builds up a recent shell history specific to the directory it sits…

I have the same workflow for switching between tabs, although on Mac the default keyboard shortcut for switching Terminal tabs (Cmd + Shift + '[' or ']') was a little too cumbersome. I swapped it out with (Cmd + '[') which by default will take you to the next Terminal, not tab. I move left to right more, so it made more sense for me. Easy enough to change in system preferences, though. And with using Vim NERDtree, or…

I'm on OSX using iTerm2. Cmd-1, Cmd-2, etc are how I switch between tabs. I keep specific things at specific numbers so it's easy to move around.

For example, the project I'm working on is always tab 1, pianobar (terminal pandora client) is always tab 4.

This is really nice because it's also how I switch tabs in Chrome. So both Chrome and iTerm have my current work on tab 1.

Re: OS X Command Line Utilities

#166

pbpaste and pbcopy can specify multiple clipboards; one very handy thing I do is "cmd-a" "cmd-c" (copy all) double click on a word I'm looking for, "cmd-e" to enter it into the find clipboard 'pbpaste | fgrep --color `pbpaste -pboard find`' I have that aliased as 'pbg'.

Aaaaand I just learned about Cmd-E and Cmd-J. Love all the little useful shortcuts OSX has. :)

Re: OS X Command Line Utilities

#167
post #90

Earlier quoted context omitted.

> Go fullscreen. Not so much for the real estate but for the mental switch. Fullscreen mode is a way to immerse yourself into your productive development world. No browser, no mail, no application notification. Only code. This is an excellent point and one that's not nearly as appreciated as it should be. Fullscreen mode was written off in Lion as an example of Apple dumbing down the platform and making it more like…

I use sizeup[1] to maximize the terminal (or any other app) with a keystroke, instead of native full screen. It works across all applications that allow window resizing, and has handy shortcuts for "half" full screen, which is great to position, say, a browser and editor next to each other across the whole screen. Which reminds me, I really will go and pay my 13 bucks for it now, it's more than worth it. But the free…

[deleted]

Re: OS X Command Line Utilities

#168

no love for macport?

My understanding is that macports is a lot more finicky and hacky, especially when it comes to built-in dependencies. homebrew is specifically designed to avoid such problems.

The important thing is not to use them together. I did, and it was a nightmare.

Re: OS X Command Line Utilities

#169
Also worth mentioning is dotfiles (not specific to OS X). Basically various well known "power users" share their bash, homebrew, etc settings on github so that they can easily set up a new machine with minimum of fuss. There are a lot of neat trick in those boilerplate files.

http://dotfiles.github.io/

Re: OS X Command Line Utilities

#170

This was supposed to be few lines of remarks. It expanded quickly in relation with my enthusiasm for this topic. I've been investing some time in the command line on my Mac. I am moving from a dilettante going to the shell on a per-need basis to a more seasoned terminal native. It pays off handesomely! It's hard to convey how nice it to have to have a keyboard-based unified environment instead of a series of disjoine…

> You can make the terminal start instantaneously instead of it taking several seconds.

You can fix that properly in two steps:

1. Create a symlink to your preferred shell. E.g. `sudo ln -s /bin/bash /usr/bin/bash`

2. In Terminal Preferences, use /usr/bin/bash as your shell, instead of the default login shell.

To confirm that you've fixed the problem:

- Open a new terminal window.

- "Last login" should NOT be displayed.

- Hit Command+I to show the inspector. The command should read: login -pfq username /usr/bin/bash.

The -q switch on /bin/login is what speeds things up. (.hushlogin does not solve the problem)

In order to get Terminal to pass the -q switch to /bin/login you have to use a non-standard shell, hence the symlink.

Post reply on HN