Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

441–450 of 454 posts

Re: macOS command-line tools you might not know about

#441

Earlier quoted context omitted.

I’d say hand-crafting pixel-perfect icons with different versions for extreme sizes is worthwhile (and I don’t believe in simple rasterization from vector for the same reason), but not every developer would have resources to spare for that.

I was lucky enough to oversee a project replacing seven hundred icons back in 2017, and we hand-adjusted the low resolution versions of 16x16 and 24x24. > “…notice that the icons are not simply the same image scaled up or down. TTrackBar is a good example of this: at each size, the small indicator marks are different. An icon designed for 16×16 or 32×32 won’t resize and scale to look good at 24×24, because the pixel…

[dead]

Re: macOS command-line tools you might not know about

#442
post #37

I remember Caffeine used to be a third-party program that would prevent your Mac from sleeping, same behavior as the `caffeinate` here. Were they acquired and incorporated into the OS?

Anyone know of a Ubuntu on WSL equivalent?

apt install caffeine

Re: macOS command-line tools you might not know about

#443
post #232

Earlier quoted context omitted.

I'm curious why the Bluetooth is required? Requiring WiFi makes (so the phone/computer is on a network and can communicate with the other devices), but what's the benefit of Bluetooth? Does it only work when the phone and computer are near each other?

Bluetooth is used to discover peers and to initiate communication. Thus handoff works even on a wifi network that blocks broadcasts. It even works when no wifi network is present, by setting up an ad hoc network for the connection. (Disclaimer: This is all I know. The details seem rather murky, as handoff is a proprietary Apple protocol.)

The requirements are here: https://support.apple.com/en-au/HT209455

Turning off Bluetooth or wifi may be one of the more common reasons it doesn’t work. Some people never do that, but others do.

Re: macOS command-line tools you might not know about

#444
post #417

Earlier quoted context omitted.

Simply wrap your shell with osc52pty to get OSC52 support in Terminal.app https://github.com/roy2220/osc52pty

I don't think wrapping my entire shell session in a moderately complex third party tool (that maybe just uses pbcopy under the hood[1]) counts as "simply" when compared to my existing solution which just pipes over ssh and a couple bash scripts. But thank you for the share, it is interesting! [1]: https://github.com/roy2220/osc52pty/blob/master/oscexecutor....

This tool isn’t doing anything particularly complex. It sets up a new pty, attaches the child process to it, listens for OSC52 control codes, and calls pbcopy when appropriate.

You can wrap your ssh session with it and you’re done.

It’s very elegant and multiple orders of magnitude less complex than something like tmux.

Re: macOS command-line tools you might not know about

#445

Earlier quoted context omitted.

And I have one that unifies _both_ to `clip` so you can put the same command in both sides of the pipe, e. g. to turn a line-delimited blob on your clipboard to a space-separated one: clip | tr '\n' ' ' | clip https://github.com/svieira/dotfiles/blob/a3654d6a194e3689978... # Use clipboard in shell pipelines # clip | xargs echo # uses pbpaste # ps -A | grep search | clip # uses pbcopy clip() { [ -t 0 ] && pbpaste || p…

So to check if there's anything sitting on stdin without reading it I've been using `if read -r -t0; then` # returns true if there is data but times out instantly so it doesn't consume any Is `[ -t 0 ]` more idiomatic? Apparently it fails on this case: function `read -r -t0` is Bash-only though and not POSIX, but it will work regardless of what type of data is on stdin

[ -t 0 ] instead checks whether stdin (fd 0) is a tty.

Re: macOS command-line tools you might not know about

#447
post #139

Not a bad list of basic macOS specific cli tools. For a more in depth list, I usually reference https://ss64.com/osx/ .

A tad outdated. At a glance I see it’s missing `networkQuality` (introduced in Monterey) and `realpath` (added in Ventura).

Yes it is, but the forum is current and the creator replies very actively. I’ll ask if he plans update.

Re: macOS command-line tools you might not know about

#448
post #215

Earlier quoted context omitted.

Automatic screensaver enable after a period of inactivity is considered a fail safe control.

`caffeinate` can set assertions, the same assertions that Zoom or PowerPoint or Keynote do to stop the screen going to sleep during a meeting or presentation, the same assertions that the browsers can set during streaming video, so you absolutely can bypass whatever your admins set using `caffeinate -dmisu` which sets every assertion available.

It’s not about capabilities, it’s about policy. Willfully violating security policies is generally going to go over poorly.

Re: macOS command-line tools you might not know about

#449
post #8

`pbcopy` and `pbpaste` are one of my most-loved in the list. Dealing with some minified json, switching to iTerm, doing `pbpaste | json_pp | pbcopy` and having a clean output is _so_ nice.

my favorite vim command:

:w !pbcopy

or visual selection, and then :w !pbcopy

Re: macOS command-line tools you might not know about

#450
post #382

Earlier quoted context omitted.

It’s wonderful when it works. For reasons beyond my comprehension, the Watch unlock for my Mac only works ~10% of the time.

There’s a fix for it where you remove all the unlock entries in Keychain, and then re-enable it. Only thing that worked for me long term (but it did fix it 100%) https://georgegarside.com/blog/macos/fix-apple-watch-auto-un...

I tried this yesterday. It... helped. But what I've now found is that if I escape out of the password prompt (which will turn the screen off again) and then try to unlock it a second time, the watch unlock will be triggered. I wonder if it's something about waking from sleep. (I also wonder if it would have worked before to do the same thing, but it never occurred to me to try.)
Post reply on HN