Hacker News new | past | comments | ask | show | jobs | submit login
Awesome OS X Command Line (github.com)
383 points by sndean on Feb 17, 2017 | hide | past | web | favorite | 54 comments

While the cli forms of the various "defaults" registry commands are interesting and useful for e.g. scripting provisioning of many new machines, on a one-off basis it's probably easier to just use TinkerTool (https://www.bresink.com/osx/TinkerTool.html) which offers most of them with checkboxes or radio buttons

(One could argue about safety/visibility/trust but it's really probably no worse, and possibly better, than any installer to which you give your password)

There's also OnyX: http://www.titanium.free.fr/

I was thinking that a few those can be found in http://secrets.blacktree.com/ and the boom the website is gone.

Thankfully the payback machine is there for you: https://web.archive.org/web/20150621044359/http://secrets.bl...

I should start donating money to those guys

I think you mean the Wayback Machine. The Payback Machine sounds pretty badass though.

Great name for a band.

macOS spelling checker strikes again?

Thankfully, the fine article offers a solution :D

defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false

For this kind of setup I use this very well maintained script


This dotfiles repo is even recommended by Github at https://dotfiles.github.io/

I don't think that's a recommendation by Github. The site even says "Your unofficial guide to dotfiles on GitHub." and none of the 3 members of the dotfiles org seems to be Github employees. Neat list tho.

I also use that script but beware: please go carefully through it, and disable lines where necessary. For instance, it assumes you have a small SSD: it disables hibernation (lines 138-148) and disables local Time Machine backups (line 677 and 678). This is almost certainly not what you want.

Ditto: https://github.com/pavellishin/dotfiles/blob/master/osx-setu...

And thank you for the sound effect on boot killer - I loathe, loathe that stupid sound.

Worth reading for this alone:

    # Stop iTunes Responding to Key Presses
    launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
Also, pbcopy tends to not work in tmux - I've been using this as a workaround: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard

Nice list.

Maybe it's just me getting older and grumpier but I see the word "awesome" being overused so much that it has completely lost its original meaning. If everything is awesome, nothing is.

It's just how these types of lists are called; "awesome" doesn't imply anything other than it's a list of resources and material pertaining to a specific topic (usually tech/programming).


It's just a category/brand. I do like being able to search "awesome x" for anything when I want to browse libraries or tips. Better than guessing what the repo name would be.

That's just part of the daily coding jargon. Call it a pet peeve, but it frustrates me intensely when everyone calls their defaults 'sane' (implying others their defaults are not). Such a misused word. Same goes for sensible. Seriously, if you start looking out for these two words, you'll notice how stupidly overused they are..

Not that I necessarily disagree with your overall sentiment, but I think you've chosen a poor example:

>(implying others their defaults are not)

This is wrong. The point of "sane defaults" is something along the lines of "first do no harm", a sort of minimal starter where if, in principle, an operator started using it out of box and never ever touched a single configuration file or setting, they might lose out on many features or potential but they'd have something minimally usable and that would in general not cause issues. There isn't necessarily one set of possible sane defaults, but it's not hard to imagine INsane defaults for a lot of software or hardware. This is particularly a big deal with all sorts of products that have security, infrastructure, or safety implications. Networking hardware/software products for example necessarily have a great deal of complexity and flexibility under the hood, but that makes Foot-Gun Syndrome a real issue. So they also generally have minimal default factory settings that aim to ensure that they can in fact be configured, accessed, and won't immediately open any gaping holes, flood the network, etc. A firewall might have "sane defaults" of nothing, or perhaps minimally allowing SSH from the LAN and port 80/443 say. An OS should by default not expose services to the net (this was a real problem at one point).

Sane/sensible defaults acknowledge the fact that most consumer users never touch settings, and that even expert users appreciate having a good basic starting point that they can customize from or reset to. "Everyone" thinks about this because it's a universal problem for any configurable software/hardware.

I've always taken it to be a short way of saying, "our best shot at sane and logical defaults".

Completely agree with your sentiment.

I'm from India and see lots of people using 'Awesome' and 'Cool' in tech community, and sometimes I wonder why would someone use words like these for very normal things?

Although I don't mind usage of awesome in OP's case. This is generic format for listing of resources.

Awesome is just the new "epic" from a few years ago, don't worry about these little things :-)

And amusingly, "epic" replaced "awesome" a few years before that.

And lets not forget "epic" being used more often in the 16th century.

Does anyone know how to uninstall the Google Update that ships with Picasa 3.9.140 for Mac? That's the last version of Picasa that works with local folders.

[Edit] I think I figured it out. The ~/Library/Google/GoogleSoftwareUpdate folder was being recreated every time I opened Picasa. So, I emptied out ~/Library/Google and then changed it's owner. Next time I opened Picasa, it remained empty.

I find it handy to add a few of these as a service, so they're accessible through context menus.

Basic steps found here: http://michal.karzynski.pl/blog/2013/01/13/how-turn-shell-co...

Being able to access SF Mono outside of terminal is really nice

I've never seen AppleScript before, and I'm fascinated by the syntax. Is it as easy to write as it is to read?

No. It's probably the most frustrating syntax I've had the (dis)pleasure of working with.

Sadly, I have to agree. The first time you see an AppleScript, you think, wow, that looks great, can't wait to dive in. Two hours later, still can't get the simplest little things to work, start wondering if maybe I can do this with a bash script, or something else ...

Anything remotely complex is weird and unintuitive. I've had the displeasure of writing AppleScript as both a novice and intermediate scripter/programmer. The latter is much more frustrating because instead of just the "natural language"(for lack of a better term) falling apart you are now very much aware of what it's lacking.

It's been a little while since I last wrote any AppleScript but while I didn't find it completely horrendous to write, it was certainly harder to write than most scripting languages because there is a lot to remember about how a script can and can't be structured.

You can now write in Javascript instead of Applescript (https://developer.apple.com/library/content/documentation/La...). For examples of Applescript equivalent code in Javascript, see https://github.com/dtinth/JXA-Cookbook. Yes, Applescript looks horrible, but it was originally designed for non-programmers, so it had very verbose English-like syntax.

My experience has been that it's pretty frustrating after a few minutes. It's a dead language with very few references available online. Apple recently added support for using JavaScript wherever you'd use AppleScript, and it wouldn't surprise me if they end up killing it off completely in a few years.

Unfortunately if you know English, the doors to truly learning AppleScript are forever closed to you.

That one could be really useful :

Dock : Add a Stack with Recent Applications

  defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \ killall Dock

I have that, it is kinda useful sometimes. Usually it is faster to just re-open it with Alfred/Spotlight though.

Hey that's cool stuff. For a total ignorant like me, where should I go to learn the basics of automating some tasks like I'd like to type $ ipaddress and get the local ip address instead of $ ipconfig getifaddr en0. Is that bash? How is that called? How do I make "programs" to automate tasks and run them from terminal with a single customized word like dbstart dbstop?

Thanks for the pointers.

The first way that comes to mind is to use alias, e.g. `alias ipaddress="ipconfig getifaddr en0"`. Then running `ipaddress` would do what you want. To avoid having to run this again every time you log in, you can add the same line to your `~/.bash_profile`, which configures your shell when you log in before the initial command prompt. You can then type `source ~/.bash_profile` to reload your configuration without having to log out then back in.

Ok, so I write a bash script then create an alias for it like alias hello="bash hello.sh"

Something like that? I found some nice bash tutorials that'll keep me busy for the weekend. Thanks.

Edit: Ok, apparently alias hello is not needed since hello.sh can be run directly with just the name, I was having permission problems and couldn't make it run, but now with just $ hello I can see the output. I'm loving it!

or just box$ . ~/.bash_profile

But I prefer zsh/prezto. I spend far too much time on the command line, so I want it to look pretty and tab-complete all the things.

TIL you can make Finder quittable! It has always irked me that you can't quit it.

Is it actually quittable or does quitting it just relaunch it? Because using killall Finder on the command line or killing through Activity Monitor just kills and then relaunches Finder.

It is actually quittable, but you have to set a 'defaults' option to make it happen.

    defaults write com.apple.finder QuitMenuItem -bool YES
Once that's done, you can quit it from the menu or hit CMD-Q, and it stays dead. If you do an ungraceful quit from the force quit menu or by sending it a signal, it'll still relaunch.

I think the quittable Finder is a default in El Capitan. Either that or I enabled the setting and forgot about having done it.

You must have enabled it, I'm still on El Cap and it's not the default (also did a clean install of it).

The 'tput bel' command has got be there by default & those who don't want it can uncheck it from pref. It'd save so much time & strain by not looking for a completed task/prompt for input.

I'm missing a "Enable select from QuickLook". Most annoying that Apple removed that feature. Otherwise good list.

A command to enable/disable the Socks Proxy on my wireless network adapter would be super! It's six clicks right now.

sudo networksetup -setsocksfirewallproxystate "Wi-Fi" on|off

Wow!! You're awesome!!!

Disappointed this isn't Awesome (the window manager) for Mac. I use Spectacle, but Awesome would be welcome.

i want job

The first step is finding something that you can "curate" that hasn't been "curated" yet. It's all the rage these days.

I just saw 'Awesome' and 'Command Line' and confused it with the Awesome window manager of Linux.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact