Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

181–190 of 243 posts

Re: OS X Command Line Utilities

#181
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.

I use homebrew in /homebrew for exactly this reason. The homebrew folks make noise about this, but I don't install language specific packages via brew, so I've never had a problem.

Re: OS X Command Line Utilities

#184

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…

I have my current git branch display as part of my command prompt when I'm in a project directory.

parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^]/d' -e 's/ \(.*\)/(\1)/' }

export PS1="\u@\h \[\033[32m\]\$(parse_git_branch)\[\033[00m\] \W $ "

Re: OS X Command Line Utilities

#185
post #91

Earlier quoted context omitted.

iTerm2 does vertical and horizontal splitting better than Terminal.app. tmux does vertical and horizontal splitting better than screen. That's my rationale for using iTerm2 and tmux instead of Terminal.app and screen. (yes, I'm aware that screen has improved its splitting recently, but I switched to tmux in 2011, after seeing a presentation about it by Nicholas Marriott)

Why split your terminal if you have screen / tmux?

[deleted]

Re: OS X Command Line Utilities

#186
post #163

Earlier quoted context omitted.

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 c…

/opt/homebrew would be consistent with other large systems. I'd like to see that be the default.

Re: OS X Command Line Utilities

#187

Earlier quoted context omitted.

Look into getting Emacs in one of its native OS X incarnations rather than using it in the terminal. Emacs is going to have a lot more options for colors (font locking is the Emacs-speak, I think) in its own app than when it's boxed into a terminal. You also get support for multiple "frames" (windows); Vim can't do this at all and I still miss that from Emacs. I use Linux rather than OS X but if you are parked in Ema…

Vim can absolutely do multiple "frames". They're called splits.

No, it cannot. An Emacs "frame" is a separate editor window, managed by the window manager. Different Emacs frames running the same Emacs session talk to each other--they share the buffer list, etc. Within the Emacs "frame" you can have split "windows".

One Vim session can live only in one window that is managed by the system window manager. You cannot have multiple windows that talk to each other. You can split a single window manager window using ":split" and the like. Vim calls these "windows". You can have multiple tab pages, each of which holding multiple Vim windows, but all these tab pages must reside in a single system window-manager window.

Vim has a help file somewhere saying that Bram Moolenaar knows this is a problem and it's on the todo list.

Re: OS X Command Line Utilities

#188

Earlier quoted context omitted.

cmd+shift+eject

Ctrl + Shift + Eject or Ctrl + Shift + Power (on MacBook Pro's that don't have an eject key) Cmd + Shift + Eject doesn't do anything.

This sleeps/suspends rather than just locking. Equivalent to closing your MacBook.

Re: OS X Command Line Utilities

#189
post #5
post #3

My favorite command is 'say'. You can do all kinds of silly voices. Try this out: say hello -v Good

For anyone wondering, you can also do this: say -v '?' (This gives you a list of voices) say -v Good (This let's you type in a stream of text)

In Mavericks, selecting Customize from the System Voice dropdown of the Dictation & Speech preferences brings up a list of voices you can download as well. I think Alex was my default, but some of the others seem much better.

Re: OS X Command Line Utilities

#190
post #153
post #79

Earlier quoted context omitted.

> You can make the terminal start instantaneously instead of it taking several seconds. Terminal has started instantaneously on all my Macs for years, since the advent of SSDs. A tiny fraction of a second. If it is taking several seconds to launch, I think something must have gone haywire somewhere.

A friend of mine was experiencing multiple-second launches for Terminal. When he looked, he saw that it was occupying about 1 GB of memory. Turns out the option to maintain ALL HISTORY EVER as scrollback was turned on. So he had the last year of compiler output and whatnot stored in a file somewhere, getting loaded into memory the first time he launched Terminal after a boot, and then eating a big chunk of his laptop…

Holy crap.

I leave Scrollback limited to "available memory", which I assume is what you're referring to, but I also compulsively hit ⌘K to clear my scrollback.

Post reply on HN