News for hackers. Stuff that matters.
Re:Show HN: Swiss Army Knife for Mac OS X by koenigdavidmj on Thursday July 14, 2016 @07:42PM (#12098057)
The last one of these that popped up on HN replaced a lot of the common UNIX commands, and a lot of people here rightly asked 'why would I run "mac tar:extract" when I could just run "tar xf"?'

This one seems to get the balance a lot more right, with a lot of things that the average OS X admin wouldn't know off the top of their head.

- 'm lock': That's a lot better than whichever arcane key combination does it by default (my laptop stays closed most of the time, so the power button isn't an option).

- 'm nosleep': I would have to look that one up.

- 'm finder showhiddenfiles': It beats Googling for the proper 'defaults write' invocation.

Re:Show HN: Swiss Army Knife for Mac OS X by paxswill on Thursday July 14, 2016 @10:06PM (#12098551)
The basic command for keeping the machine awake is `caffeinate`, and has a few other nice options like changing what kind of sleep is prevented (disk, display, system) and also waiting on a PID (looks like that was added in 10.10).

Related to that is `pmset -g assertions` which will list all the various things that are keeping your machine from sleeping.

Re:Show HN: Swiss Army Knife for Mac OS X by therealmarv on Friday July 15, 2016 @06:55AM (#12100062)
strange, I always used `pmset noidle` instead of `caffeinate`. But seems it does the same. I somehow assumed `caffeinate` is the same as this app store thing called Caffeine.
Re:Show HN: Swiss Army Knife for Mac OS X by paxswill on Saturday July 16, 2016 @12:29PM (#12106873)
Using `pmset noidle` is now deprecated in favor of `caffeinate` according to the pmset man page.
Re:Show HN: Swiss Army Knife for Mac OS X by therealmarv on Wednesday July 20, 2016 @01:28PM (#12130818)
Good to know!
Re:Show HN: Swiss Army Knife for Mac OS X by jzelinskie on Thursday July 14, 2016 @09:22PM (#12098414)
I think if you go to the Keychain, you can configure it to put an icon in the top right tray that you can click on to lock your computer. I often find myself accidentally moving my mouse to the top right corner of my Windows and Linux machines to lock them now.
Re:Show HN: Swiss Army Knife for Mac OS X by ytjohn on Thursday July 14, 2016 @10:08PM (#12098559)
That is exactly what I do. I think that the combo I would normally try (Cmd+L) logs you out. I remember at one point trying to find the correct key combination, and the primary results were to put the lock icon up. That works find enough for me.
Re:Show HN: Swiss Army Knife for Mac OS X by krrrh on Friday July 15, 2016 @07:52AM (#12100318)
Defining a hot corner in the bottom left in trackpad prefs has been my go to for years. It works fast and is rarely activated by accident.
Re:Show HN: Swiss Army Knife for Mac OS X by jonhohle on Thursday July 14, 2016 @08:07PM (#12098167)
My first impression was _gaah!_ just RTFM! But after calming down, I realized this is not significantly different from a command line version of TinkerTool. Not necessarily something I would use, but I could see an audience for it.
Re:Show HN: Swiss Army Knife for Mac OS X by hammerha on Thursday July 14, 2016 @10:43PM (#12098660)
There's a more popular but similar project. https://github.com/guarinogabriel/mac-cli Has anyone used both?
Re:Show HN: Swiss Army Knife for Mac OS X by nicolas_t on Friday July 15, 2016 @06:32AM (#12099975)
I find that mac-cli is too unfocused with functions like ssh, tar, magento support, mysql support which are not really needed and common between platforms.

I like the exclusive focus of this tool to only mac administration tasks which are specific to mac OS X and that I would not know off the top of my head.

Re:Show HN: Swiss Army Knife for Mac OS X by ralfd on Friday July 15, 2016 @05:25AM (#12099750)
It literally says on the github page of OP submission, that Mac-CLI was inspiration.

HNews discussion about it 3 weeks ago:

https://news.ycombinator.com/item?id=11977162

But I too wonder why I should use this instead of Mac-CLI?

Re:Show HN: Swiss Army Knife for Mac OS X by rgcr on Friday July 15, 2016 @08:50AM (#12100580)
I think @koenigdavidmj has the answer :)
Re:Show HN: Swiss Army Knife for Mac OS X by donretag on Thursday July 14, 2016 @08:38PM (#12098264)
I like how each function is contained in an individual plugin file. I can install (create a local script) which plugins I want without needing to install them all. Even if you do not want to install any of the code, it shows you the command line needed in OS X.

The volume plugin has a more fine-grained control for adjusting the volume. The keyboard based function keys will increase/decrease the volume by 6/7. Now I can increase by smaller increments. Excellent.

Re:Show HN: Swiss Army Knife for Mac OS X by smnscu on Thursday July 14, 2016 @09:09PM (#12098380)
You can use Alt+Shift+VolumeUp/Down to change volume by quarters of an increment.
Re:Show HN: Swiss Army Knife for Mac OS X by bigboat on Thursday July 14, 2016 @10:25PM (#12098606)
Karabiner allows you to change the default behavior of the volume keys to use quarter steps with the "Fine grained volume controls" option (it simply adds the alt+shift for you). Very useful with headphones that are too sensitive. https://pqrs.org/osx/karabiner/
Re:Show HN: Swiss Army Knife for Mac OS X by sn0v on Thursday July 14, 2016 @09:08PM (#12098378)
As an aside, holding down the option key on your Mac while adjusting the volume will do it in much smaller increments.
Re:Show HN: Swiss Army Knife for Mac OS X by legulere on Friday July 15, 2016 @01:19AM (#12099090)
That something like this exists shows some problems with the unix shell: No standardized commands exist for many common actions (sleep, wifi, etc). The syntax is different across commands even on a single system.

It's really nice, but I'd like to see something like that as a standard in shells.

Re:Show HN: Swiss Army Knife for Mac OS X by Scarbutt on Friday July 15, 2016 @02:41AM (#12099287)
I don't know, CLI commands in os x are much worse than in linux, want to display wifi info?

$/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I

lots of useful commands like that are not in your path by default, that said, at least os x lets you modify almost any part of the system with shell commands.

Re:Show HN: Swiss Army Knife for Mac OS X by SG- on Friday July 15, 2016 @05:19AM (#12099736)
which airport

/usr/local/bin/airport

Re:Show HN: Swiss Army Knife for Mac OS X by danbee on Friday July 15, 2016 @08:32AM (#12100491)
Tried that on my Mac

$ which airport

airport not found

Re:Show HN: Swiss Army Knife for Mac OS X by Alphasite_ on Friday July 15, 2016 @01:30PM (#12102554)
It's not linked by default.
Re:Show HN: Swiss Army Knife for Mac OS X by javajosh on Thursday July 14, 2016 @07:41PM (#12098053)
I like it! I wish it had some features for making a screenshot, taking a photo, and recording video or sound for n seconds. A packet capture for n seconds might be nice, too (although that would certainly be more involved). Might as well add keyboard/mouse logging for n seconds. :)
Re:Show HN: Swiss Army Knife for Mac OS X by stereo on Friday July 15, 2016 @07:56AM (#12100333)
It’s not really clean, how it asks for /usr/local/m-cli to be added to $PATH but then litters that directory with other scripts.
Re:Show HN: Swiss Army Knife for Mac OS X by JadeNB on Tuesday July 19, 2016 @02:47PM (#12123844)
It does mention that you can put it elsewhere:

    INSTALL_DIR=$HOME/.m-cli sh <(curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.sh)
Re:Show HN: Swiss Army Knife for Mac OS X by 64bitbrain on Friday July 15, 2016 @01:30AM (#12099122)
Does it need to be ran as root?

Downloading m-cli from git to /usr/local fatal: could not create work tree dir '/usr/local/m-cli': Permission denied Failed to clone => https://github.com/rgcr/m-cli.git

Off course it won't be able to access the /usr/local/

Re:Show HN: Swiss Army Knife for Mac OS X by planb on Friday July 15, 2016 @01:36AM (#12099135)
Most people using this probably have homebrew installed, which makes /usr/local writable for the main user.
Re:Show HN: Swiss Army Knife for Mac OS X by JadeNB on Tuesday July 19, 2016 @02:48PM (#12123855)
The README addresses this (with the somewhat elliptical "You need privileges"), and points out a work-around:

> You can also install it in a different path

    INSTALL_DIR=$HOME/.m-cli sh <(curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.sh)
> Note: You need privileges
Re:Show HN: Swiss Army Knife for Mac OS X by JustSomeNobody on Friday July 15, 2016 @09:21AM (#12100721)
As opposed to alias in bashrc for the commands you use most often?

This and the other one that was on HN a short while back, I just don't get the point. Learn the command line, already. Yes, some are hard to remember, but that's why history exists. And if you rarely use one, keep it in a simple, greppable text file.

Re:Show HN: Swiss Army Knife for Mac OS X by Lio on Thursday July 14, 2016 @07:31PM (#12097982)
Not sure I like the install method. I'm nervous of anything that asks me to pipe curl to shell.
Re:Show HN: Swiss Army Knife for Mac OS X by arnarbi on Thursday July 14, 2016 @07:35PM (#12098009)
Are you less nervous running a binary installer?
Re:Show HN: Swiss Army Knife for Mac OS X by beachstartup on Friday July 15, 2016 @12:12AM (#12098895)
i'm not. all of it makes me nervous. even package managers with supposedly cryptographically secure verification make me nervous.

but, you gotta do what you gotta do to actually do stuff.

i sure as hell ain't going back to the days of compiling everything from source.

Re:Show HN: Swiss Army Knife for Mac OS X by seanwilson on Friday July 15, 2016 @07:19AM (#12100168)
> i'm not. all of it makes me nervous. even package managers with supposedly cryptographically secure verification make me nervous.

Android and Chrome for example are really ahead of this in my opinion. Apps are sandboxed and you know uninstall clears up traces of them. Obviously it's not perfect but it's miles ahead of installation scripts and binary installers which can do anything they want with your system and might be hard to get rid of.

Re:Show HN: Swiss Army Knife for Mac OS X by yoz-y on Friday July 15, 2016 @07:57AM (#12100338)
That is what Mac App Store is for. However, all of these sandboxed environments come with their own sets of problems and make making especially these kind of tools quite difficult if not impossible.
Re:Show HN: Swiss Army Knife for Mac OS X by pjmlp on Friday July 15, 2016 @09:50AM (#12100890)
> Apps are sandboxed and you know uninstall clears up traces of them.

Not in all versions of Android, if they write stuff on the SD card.

Re:Show HN: Swiss Army Knife for Mac OS X by seanwilson on Friday July 15, 2016 @06:17PM (#12104184)
They might be able to write some files that sit around but not code that runs on startup and spies on you for example.
Re:Show HN: Swiss Army Knife for Mac OS X by slrz on Friday July 15, 2016 @09:52PM (#12104866)
So how would you go about packaging this m-cli tool into a sandboxed app?
Re:Show HN: Swiss Army Knife for Mac OS X by ghshephard on Friday July 15, 2016 @12:53AM (#12099001)
Okay - I'm curious. What is wrong with:

  ./configure
  make
  make install
I do that a lot, and 90+% of the time, it's that simple.
Re:Show HN: Swiss Army Knife for Mac OS X by beachstartup on Friday July 15, 2016 @01:13AM (#12099059)
uh yeah, it's the other 10% that's the problem.

not to mention the tracking of installed files and library dependencies that slowly develop into an accumulated spiderweb shitstorm of runtime conflicts.

have you tried maintaining multiple versions of a shared object libraries by hand? do you remember the 'make install' wrappers that never worked right? pepperidge farm remembers.

Re:Show HN: Swiss Army Knife for Mac OS X by auvi on Thursday July 14, 2016 @07:37PM (#12098022)
the best way to get rid off the discomfort is to first check the shell script: curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.... | pbcopy

Then you can paste it in a text editor and if it is not too long you can verify the script.

And as this one is on github you can take a look directly.

Re:Show HN: Swiss Army Knife for Mac OS X by theseoafs on Thursday July 14, 2016 @08:34PM (#12098249)
Just pipe the script to a file so you can read it without having to copy-paste. :)

curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install..... > install.sh

Re:Show HN: Swiss Army Knife for Mac OS X by jlgaddis on Thursday July 14, 2016 @10:57PM (#12098701)
Or use curl's built-in options:

  curl -O ...
or

  curl -o install.sh ...
Re:Show HN: Swiss Army Knife for Mac OS X by Alphasite_ on Friday July 15, 2016 @01:32PM (#12102569)
Or pbpaste | sh
Re:Show HN: Swiss Army Knife for Mac OS X by curun1r on Thursday July 14, 2016 @10:54PM (#12098688)
Also not to like about the install method: The install.sh stores INSTALL_DIR in a variable but does not allow that variable to be overridden by the environment. So you're forced to install into /usr/local despite then being asked to add /usr/local/m-cli to your path. It would be better to allow /usr/local to be overridden so that installation doesn't require sudo. It's just as easy to add ~/.m-cli to your path.
Re:Show HN: Swiss Army Knife for Mac OS X by JadeNB on Tuesday July 19, 2016 @02:51PM (#12123886)
> The install.sh stores INSTALL_DIR in a variable but does not allow that variable to be overridden by the environment.

Really? The documentation explicitly says that it does:

    INSTALL_DIR=$HOME/.m-cli sh <(curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.sh)
Re:Show HN: Swiss Army Knife for Mac OS X by javajosh on Thursday July 14, 2016 @07:38PM (#12098029)
You can always pull and build - but of course that's risky too, roughly in proportion to the size of the working copy.
Re:Show HN: Swiss Army Knife for Mac OS X by barefootcoder on Friday July 15, 2016 @01:52AM (#12099173)
The thing is, in this case you can easily inspect the shell script that they're running with that curl command.
Re:Show HN: Swiss Army Knife for Mac OS X by bubbleRefuge on Thursday July 14, 2016 @10:34PM (#12098640)
m dir tree returns:

/usr/local/m-cli/plugins/dir: line 3: /lib/functions.sh: No such file or directory

Re:Show HN: Swiss Army Knife for Mac OS X by miles on Thursday July 14, 2016 @07:36PM (#12098011)
Thanks for crafting and sharing this.

I must admit to flagging this particular submission, as it is the fifth time it has been posted in as many days, with no other contributions (whether of comments or stories) to speak of. Forgive me if this seems harsh, but just to keep submitting the same item over and over without any other activity (including responding to comments made in the prior submissions) does not seem in alignment with HN.

Re:Show HN: Swiss Army Knife for Mac OS X by visionscaper on Thursday July 14, 2016 @07:59PM (#12098134)
I read HN every day and this is the first time I've seen this submission...
Re:Show HN: Swiss Army Knife for Mac OS X by miles on Thursday July 14, 2016 @08:16PM (#12098195)
Here are the previous submissions:

https://news.ycombinator.com/submitted?id=rgcr

Re:Show HN: Swiss Army Knife for Mac OS X by sulam on Thursday July 14, 2016 @08:55PM (#12098328)
Super curious as to why you're getting downvotes... :/
Re:Show HN: Swiss Army Knife for Mac OS X by mohsinr on Thursday July 14, 2016 @08:07PM (#12098163)
Same here.
Re:Show HN: Swiss Army Knife for Mac OS X by javajosh on Thursday July 14, 2016 @07:43PM (#12098059)
I've been pretty active on HN the last few days, and this is the first I've seen of it. Is redundancy sufficient for flagging? I always thought flagging was only for abusive or off-topic content, and redundant submissions were a moderator thing.
Re:Show HN: Swiss Army Knife for Mac OS X by privong on Thursday July 14, 2016 @09:07PM (#12098377)
> Is redundancy sufficient for flagging? I always thought flagging was only for abusive or off-topic content, and redundant submissions were a moderator thing.

It looks like the same person was submitting the same thing, daily, to try and make it stick (without any other apparent engagement with the site in terms of submissions or comments). So I think @miles is considering that abusive behavior?

I believe when the mods ask people to resubmit something, they only ask for 1 resubmission (at least that's how it went when I was asked to resubmit something: a second shot, and it didn't get picked up, so that's that).

Re:Show HN: Swiss Army Knife for Mac OS X by kkirsche on Thursday July 14, 2016 @09:13PM (#12098392)
I don't know. I mean on one hand I get it but on the other I go plenty of times when people submit awesome stuff it's just bad timing. So I don't care.
Re:Show HN: Swiss Army Knife for Mac OS X by fapjacks on Friday July 15, 2016 @04:36AM (#12099598)
Wow! It really pays to go fishing on HN. That's what I see.
Re:Show HN: Swiss Army Knife for Mac OS X by jfb on Thursday July 14, 2016 @07:53PM (#12098108)
I"m curious about why it's written in sh, given that it's OS X only and OS X includes by default many languages significantly less crappy than Borne Shell.
Re:Show HN: Swiss Army Knife for Mac OS X by davej on Thursday July 14, 2016 @08:09PM (#12098170)
Presumably because most of the commands are just shortcuts for other shell commands. Probably the right tool for the job in this case.
Re:Show HN: Swiss Army Knife for Mac OS X by jfb on Thursday July 14, 2016 @08:13PM (#12098183)
Yeah, fair enough. Not everybody hates the shell as much as I do.
Re:Show HN: Swiss Army Knife for Mac OS X by eddieh on Thursday July 14, 2016 @08:11PM (#12098178)
Someone would ask why not write it in sh, if it was written in Python, Ruby, Perl, or Tcl. I prefer stuff like this in sh.
Re:Show HN: Swiss Army Knife for Mac OS X by pfranz on Thursday July 14, 2016 @08:35PM (#12098255)
I like to challenge myself to write little things like this as shell-scripts, too. But I am surprised they didn't at least choose use Bash instead of Bourne shell.