afconvert(1) - an audio file format converter, which includes Apple's superior AAC codec from the Core Audio framework
diskutil(8) - tons of tools for fixed and removable storage
Mostly I use XLD (https://tmkk.undo.jp/xld/index_e.html) for audio conversion (as I'm mostly converting from .BIN + .CUE to "iTunes Plus" AAC for uploading to iTunes Match); but my understanding is that under the covers it's mostly just using afconvert (or whatever the system-framework equivalent of it is.)
So if your needs are just "one audio file in, one audio file out, and let me tell you exactly what it should look like", then afconvert is probably what you want.
seec 57 days ago [-]
XLD is great.
The best thing about it is the heavy parallelization if you have many cores to throw at the problem.
You can convert mountains of albums very fast.
Love those type of OG Mac indie software.
daneel_w 57 days ago [-]
Yes, iTunes also uses the same Core Audio framework. In fact, even iTunes on Windows uses the same code base through the Quicktime-for-Windows libraries it runs off of.
I prefer to encode with afconvert on the command line because it gives me a few more options for tweaking things, that I don't have access to in iTunes (or "Music" as it's called these days). Additionally, I use a simple shell script that handles all of it when for example ripping a whole CD.
miguno 56 days ago [-]
+1 to XLD. I have been using it for years, it's a wonderful piece of software.
jghn 57 days ago [-]
> afconvert
Oh wow! A while back I ripped some concert audio from Youtube, but it was too large for me to sync using my `iTunes Match`. I've been too lazy to figure out how to downsample it juuuuust enough. But it looks like this works right out of the box
zelphirkalt 57 days ago [-]
"superior" ...
It looks silly to include such a judging adjective in the description of a comman line utility. I don't need "subtle" Apple ads on the command line. And aac is about the last format I would choose, encoding my audio in.
derefr 57 days ago [-]
To be very clear, the man page is claiming that Apple's implementation of the AAC codec [the encoder specifically] is superior to other implementations of AAC encoding; not that AAC is superior to other audio codecs.
If you're wondering how one implementation of an audio codec could be superior to others — mostly, it's because any lossy audio codec has an encoding phase called "psychoacoustic compression", where each implementation of the codec is free to do whatever it likes to "simplify" the waveform in some way (most easily pictured: by taking a Discrete Cosine Transform of the waveform, and then quantizing / convoluting some parts of the frequency space. Like what JPEG does to discard information from the chroma channels.)
IIRC, rather than blunt-force quantization, Apple's AAC encoding does clever things (akin to the instrument separation done to audio in Melodyne) to split the waveform into "features", and then discards information in such a way that the features' separability is maintained (i.e. it doesn't become harder to "pick out" any given "sound" from the audio.)
daneel_w 56 days ago [-]
Correct. Though AAC (when produced with a proper encoder) surpasses all other lossy formats with the exception of Opus.
kps 57 days ago [-]
I think those are the commenter's descriptions, not Apple's man page synopses. My system has
afconvert -- Audio File Convert
diskutil -- Modify, verify and repair local disks.
daneel_w 57 days ago [-]
Its quality is technically superior as evident from the product's PSNR and other factors. There are no "ads" here, I'm not a brand warrior, and nobody cares what formats are the last ones you'd encode your audio in.
svth 56 days ago [-]
There's also afplay - Audio File Play (plays an audio file to the default audio output). Can play all audio formats supported by CoreAudio.
hk1337 57 days ago [-]
How does that compare with ffmpeg? The arguments seem about the same.
krackers 57 days ago [-]
afcovert uses the superior inbuilt AAC converter. FFmpeg can do this as well with the right arguments but you have to dig them up and the quality is capped to a lower value than you can get with afconvert.
synthoidzeta 55 days ago [-]
Isn't -c:a aac_at the same? And then designate bitrate?
anthk 57 days ago [-]
There's no reason to use AAC when we have both OPUS and FLAC.
daneel_w 57 days ago [-]
I have three reasons: when using a good encoder (Core Audio, FDK or Nero) it's a quality-wise better lossy format than MP3, it's smaller than FLAC which matters for storage footprint, and unlike Opus and FLAC it's supported pretty much everywhere. At some point Opus will reach the same level of adoption and that's the point where I'll make the switch from AAC, because Opus is evidently a better lossy encoder per same bitrate.
ok_computer 56 days ago [-]
It’s nuts using youtube-dl and unwrapping to get the opus files are like 96kbs and sound good. 96kbs mp3 would need to mix to mono and still sound like gravel.
anthk 56 days ago [-]
Opus is today in every smartphone. MP3's died. No one cares about AAC.
You are using Opus on most VoIP/call providers.
Meanwhile, AAC, MP3, OGG... are history today.
daneel_w 56 days ago [-]
> You are using Opus on most VoIP/call providers.
No. Opus support in the PSTN is still unfortunately almost non-existent. Adoption is growing but the pace is very slow. Source: me, working in the European telecommunications industry for over a decade, specializing in telephony and SMS.
ok_computer 56 days ago [-]
I like to load WAVs on my iphone if lossless uncompressed available. AAC is the next highest quality supported lossy compression file in apple music app. From my understanding they won’t ever go to flac or opus because don’t want software decompression.
I like opus on VLC for youtube-dl rips but if I’m buying music I want lossless uncompressed.
daneel_w 57 days ago [-]
ffmpeg offers a few different encoders for many of its supported audio/video formats, and the result depends on what encoder you tell ffmpeg to use. It does not have support for using Core Audio on macOS but it does offer FDK AAC, which is one of the better AAC encoders available today - though not nearly as good as the one available in Core Audio.
seec 57 days ago [-]
Do you have any sources/informations on an objective comparison of encoders quality ?
Way back then (iPod era), I made an exposé for a science exam (small paper), proving that AAC was indeed better than MP3 both subjectively and objectively at most bitrates. This is how I got introduced to Fourier transforms and the likes; it was very interesting to see that you can literally "see" the difference in quality on the encoded waveform output.
But I just used the default encoders on the Mac and I didn't think about going in deep into encoder comparisons at the time.
Does it matter that much? From what I know, it just about properly programming a math spec, with some tricks but I wonder if that makes that much of a difference.
In any case, above 256kbps it takes a very skilled listener to correctly identify encoded music. Apple has some useful tools for that, particularly AU Lab that allows you A/B testing of tracks with on-the-fly encoding.
https://www.apple.com/apple-music/apple-digital-masters/
daneel_w 57 days ago [-]
One source would be the Hydrogen Audio forums where there are regular scientific comparisons - PSNR etc. instead of blind listening tests - between various encoders and formats. Apple's AAC encoder consistently comes out well above anything MP3, best of all the AAC encoders, and up at the absolute top together with Opus which produces a bit better results per same bitrate.
> Does it matter that much? From what I know, it just about properly programming a math spec, with some tricks but I wonder if that makes that much of a difference.
It does matter a lot and the difference can be staggering. Producing the audio bitstream is a case of both effectively analyzing the original input and programmatically expressing the waveform as correctly and as efficiently possible. Two excellent examples: the old MP3 encoder Xing, which compared to LAME produces very poor material even at higher bitrates, and one of the earliest open-source AAC encoders, FAAC, which also renders a very poor product. A lot of "early adopters" got bitten by FAAC and many of them still stubbornly cling to the misunderstanding that AAC is a worse format than MP3.
seec 56 days ago [-]
OK I get it.
Isn't all that because it is rather hard to correctly implement such math trickery?
Since it's not just about manipulating bits, you need to have a pretty good background in physics to do it properly. The more you know about the physics of sound the cleverer you can be about what to discard and what to keep.
I have used Macs since my youth and used iTunes before it was even called that, so encoder quality was never a problem I had.
I guess I'll revisit the topic more deeply one of these days, still not that keen on that much math though.
meindnoch 56 days ago [-]
>From what I know, it just about properly programming a math spec
Incorrect. The specification only concerns the bitstream and the decoding. Encoders are free to do whatever they want, as long as they produce a valid bitstream.
seec 56 days ago [-]
That makes sense.
Of course, the implementations are going to have varying performance depending on code quality/optimisations but that's a given.
Edit: some other poster gave some cues to my question.
I guess you can do some trickery by decomposing the waveform before encoding and recomposing it.
I'll read more on the specs.
meindnoch 56 days ago [-]
It all boils down to the psychoacoustic model in the encoder. It determines how the bitrate is allocated to various parts of the spectrum, depending on the audio signal.
anthk 57 days ago [-]
Today OPUS is on par of AAC if not better. We aren't at the MP3/OGG times.
daneel_w 57 days ago [-]
Opus is better at same bitrate - not by much, but all the same it has the upper hand.
anthk 56 days ago [-]
>not by much
You are deluded, then. Or deaf. Most MP3 podcasts at 128 KBPS sound worse than an OPUS file @64.
daneel_w 56 days ago [-]
I'm neither deaf nor deluded. You're not reading me correctly. I'm saying that Opus is better than AAC, but not by much. Compared to MP3 it's a lot better.
satellitemx 56 days ago [-]
It does.
-c:a aac_at uses Core Audio (_at means AudioToolbox).
petecooper 56 days ago [-]
> afconvert
See also XACT[1]. It's a macOS GUI, but it's nerd-friendly.
open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).
caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.
beancookies 57 days ago [-]
Another useful caffeinate tip is the `-w` option.
You can use it to pass a pid to keep the computer awake until that process completes. I use it for longer-running scripts that I don't want interrupted
justinsaccount 56 days ago [-]
That's mostly what `caffeinate your-script` is for.
1ncorrect 57 days ago [-]
I use this all the time:
open -a <GUI Application> <File>
Handy for distinguishing between editing and consuming media.
wwader 57 days ago [-]
open -a is nice, i use it with alias, ex:
alias qt='open -a "quicktime player"'
alias vlc='open -a "vlc"'
FabHK 57 days ago [-]
At least for me (I've installed vlc via homebrew), there is a vlc binary in the PATH, and I can just
vlc <filename>
qrios 57 days ago [-]
The point here is to open a document with an app not assigned as default for the given mime-type by file name extension.
troupo 57 days ago [-]
`caffeinate -disu` is the best combination (that is, enable all options): your laptop won't go to sleep, won't dim the screem etc.
hk1337 57 days ago [-]
open -a "Finder" . - open Finder in the current directory.
Standard apps usually just need the name, like Finder and Safari but you can also specify the path "/Applications/DifferentFinder.app"
ssttoo 57 days ago [-]
`open .` works for me too
hk1337 57 days ago [-]
Yeah, I scrolled a bit and noticed that. Never thought about using just that.
1-more 56 days ago [-]
Also `open -R path/to/file` opens Finder in the containing directory with the file highlighted (and thus scrolled into view). I use this with a script that takes a screen recording and trims some specified seconds off the end and converts it to mp4 to be smaller when I upload into a Github PR description. Easiest to drag and drop the converted file, y'see.
nextos 57 days ago [-]
Finder is pretty good, and it's handy to be able to open it from the terminal. But I find it super annoying it litters everything with .DS_Store files and there is no way to turn that off, except for external and network drives. Aside from, obviously, using a different file manager. Very un-Apple.
seec 57 days ago [-]
Well those files are to keep the view/presentation settings.
I guess you could do that centrally with some sort of database but that would open another can of worms; and most importantly you wouldn't be able to transfer a folder and keep its Finder presentation intact.
Nowadays it's not as useful because of the App Store but when software was only released as .dmg images, it became expected to open a nice layout with graphics presenting the app and a shortcut to the App folder that you would drag'n'drop the app bundle to.
This presentation relies of .DS_Store to work.
There are some other use cases like that, it all comes down to a simple fact: Apple has always cared a lot more about how things look than Microsoft ever did, this is a perfect example.
vbezhenar 56 days ago [-]
There are extended attributes which could be used for this task.
seec 56 days ago [-]
I don't think xattr works for folders. And you still wouldn't have the fancy presentation you can get with .DS_Store with the graphics and all that jazz.
Of course, they could rethink the whole thing but the point is that it's a legacy thing and at this time it's not worth dedicating much ressource to a solve problem just to remove some mostly invisible files (on UNIXs).
It's really easy to have scripts to cleanup for sharing to outside world, even some zip utilities do that automatically.
It can be annoying but it's really not a big deal, I doubt they could come up with something much better while still preserving the functionality and not making another complicated/convoluted proprietary folder format that wouldn't transfer any better to Windows...
dwaite 57 days ago [-]
The .DS_Store files are not Finder specific; Apple treats everything as a file (including folders), and it exists to supply folders and the files within them with metadata.
It is just the first time the .DS_Store file is needed is often when the folder is touched by Finder.
codazoda 57 days ago [-]
.DS_Store is also a bug. I’m not sure why it hasn’t been fixed. It’s history is quite interesting but I don’t recall where I read about it.
Actually, .DS_Store is very Apple indeed (not that I care much).
luckman212 55 days ago [-]
Don't forget about "open -b <bundle_id> foo.txt" for example,
open -b com.sublimetext.4 file.txt
I prefer this vs using the App Name or Path, since those can vary depending on the system or app version. The bundle ID is more robust.
fragmede 57 days ago [-]
you can just
open .
unless you've reconfigured something else to open directories, which most people haven't.
ilyagr 57 days ago [-]
You can also `open -R file` to select that file in Finder.
seec 57 days ago [-]
That's one of macOS pitfalls: the inability to open 2 instances of the same app, simply using the default GUI is annoying sometimes.
I think Windows is right in that matter...
mjs 57 days ago [-]
Does `open` give focus? It used to, but since a few releases ago the app opens in the background, which is pretty annoying.
My poor workaround is to use osascript: `tell application "System Events" to set frontmost of process "Finder" to true`
masswerk 57 days ago [-]
Apparently, it does. There is a -g flag (background) to prevent focus.
justletmein 57 days ago [-]
Isn’t open opening apps in the background a consequence of having “secure keyboard entry” enabled in Terminal.app?
alsetmusic 57 days ago [-]
Also, `cd .` to open the current directory in a Finder window.
Not mine (found online years ago), but here's the opposite. `cd` into the frontmost Finder window:
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
kps 57 days ago [-]
You mean `open .`
alsetmusic 57 days ago [-]
Yeah, I had just woke up. Drat.
sneak 57 days ago [-]
You can also just drag the proxy icon onto the terminal window for its path, ie “cd “ <drop>, enter.
kstrauser 57 days ago [-]
I use that all the time. You can also cmd-c copy a file in Finder then paste into the terminal to get its path.
alsetmusic 56 days ago [-]
I genuinely didn't know this. I would have thought I had to do the "copy as pathname" trick with a right-click while holding Option. I already knew the drag and drop feature, so this doesn't really save me time, but it's good to know another nice feature.
impalallama 57 days ago [-]
caffeinate -d is incredibly useful for work... uh reasons
JasserInicide 57 days ago [-]
Jiggler is better for that at least from a set-it-and-forget-it perspective vs. caffeinate where you have to manually set it.
antononcube 57 days ago [-]
I would like to also recommend the app:
hear (macOS speech recognition and dictation via the command line)
> (Uses built-in macOS capabilities for transcription from audio to text.)
Question (to self, currently researching)... Which capabilities? Released when? I ask because Apple Intelligence has expanded the use of audio transcription features.
Answer: `hear` uses SFSpeechRecognizer [1] which has been available since macOS 10.15. I'm not yet sure how it relates to Apple Intelligence transcription services.
Note: "speech recognition is a network-based service" which perhaps suggests Apple Intelligence (the marketing term, not an Apple Developer term, I don't think) uses it as well
I thought I recognized the name of the developer! The person that brought us Platypus! Nice.
alsetmusic 57 days ago [-]
I used Platypus to make my simple command line tools accessible to coworkers who considered the command line to be "too much" to learn. I've loved that app for close to two decades.
hk1337 57 days ago [-]
> which hear
> hear not found
macOS 15.1
avernet 57 days ago [-]
Someone needs to create a brew formula for `hear`.
avtar 57 days ago [-]
Hear itself isn't a built-in utility.
> hear is a command line interface for the built-in speech recognition capabilities in macOS
Disk Utility used to be excellent, a model of how an app should be.
But then they rewrote it in Swift and now it's just bad.
Apple promotes Swift heavily but the results are not really encouraging.
I don't think the "so-so" results are entirely because of Swift (probably due to newer, less battle tested software and also newer/younger devs) but still the fact is, all the not-so-great new software from Apple came with Swift rewrites, hard to not make a connection...
zitterbewegung 56 days ago [-]
I have known the UI bring bad in general and I think it has more due to APFS… I used to be able to do backups but APFS is so different to everything else that at this point I wish Apple switched to ZFS but honestly that wasn’t gonna happen after the buyout of Sun to oracle .
AFPS is more complex yes, and it's sad they let down Time Machine (somewhat) with it, considering the capabilities.
But that's pretty much on point with current Apple, they would rather have you pay for iCloud "backup" than make an individual/personal solution that doesn't require subscription to their services.
It's a bit sad because the whole point of Apple was, "we are not IBM" after the PC got its start. They are very much IBM now.
As for ZFS, it has its use for sure (servers) but it's very heavy on ressource and very complex. I don't think it's just because of the buyout of Sun, overall, it's just overkill for a personal computer; and since Apple completely left the server market, even for SMBs, there is no real reason to push for it.
In the end it's not really about any filesystem, the problem is mostly that Apple is not a user focused company as much as it used to be. They could make better technical UI/Apps/Solutions but they don't care that much, they make too much money selling gadgets (those are good but really not the same thing as "proper" computers).
PokestarFan 56 days ago [-]
I wish iCloud backup was a true backup. It's really a sync, so if you accidentally rm -rf a file well you better hope you can yank out your Ethernet cable in time (or turn off wifi)
seec 55 days ago [-]
Well they do have a backup functionality, aptly named "iCloud Backup" but that's only on iOS. It's very frustrating because they are always in a rush to copy the worsts parts of iOS/iPhone for the Mac but they don't care much about bringing the good thing as long as it doesn't make them that much money.
I guess the rational is that if you have a Mac you also have an iPhone and your important data is already on your phone and thus already in a backup.
In theory they also have a file history for iCloud and you could restore files for up to 30 days, I think. I say in theory because the few times I have tried it, it was incredibly unhelpful.
But that's pretty much usual with Apple, the practice is actually very far for the theory/marketing.
alwillis 56 days ago [-]
Apple wanted a unified format for all of their devices; you’re not going to run ZFS on a watch, phone, set top box or headset.
michaelcampbell 56 days ago [-]
> all the not-so-great new software from Apple came with Swift rewrites, hard to not make a connection...
That's a leap, but I understand your point of course. It _MIGHT_ also be said it all came from ObjectiveC experts having a first go at Swift, too. Or from groups that were run by some common set of "get it out the door" middle management types.
Or any of a thousand reasons.
seec 55 days ago [-]
Yes I thought about that possibility too, but I believe most of the Objective-C old school expert are mostly gone from Apple.
It makes sense when you look at the timelines, people that were there for the early Mac days are just hitting retirement age.
Most of the executives have been replaced in one way or another, that's an indication.
And of course, Apple has a middle management problem, but that comes with Tim Cook's style; he cares about values that are just not conductive to progress and excellence. It all ends up about "getting shit done" and not caring that much if the results are actually any good.
So, they do stuff on schedule and are content with it no matter how bad it is, typical careerist behavior.
To be fair, a lot of our modern society seems to have been overtaken by these types of people, they are very popular and very "successful"; it's more noticeable at Apple because it used to be very different...
zazaulola 57 days ago [-]
`pdisk` might be more convenient if you've worked with `gdisk` on ArchLinux
If you have a modern Mac you have very little business using `pdisk`. It is only for editing disks mapped with an “Apple Partion Map”. This is obsolete replaced in practice by GPT on modern apple machines.
zazaulola 57 days ago [-]
`gdisk` supports GPT, but to partition system SSD you need to deactivate System Integrity Protection:
gdisk /dev/disk0
e40 57 days ago [-]
diskutil does more than edit partitions, though.
e40 57 days ago [-]
Or "man diskutil"
doodpants 57 days ago [-]
This article contains links to https://ss64.com/ , which is an amazing resource that I wish I'd known about sooner!
yen223 57 days ago [-]
100% That's why I made it a point to share that page.
Thanks for the kind words, I'll be scanning this thread to see if there's anything new that I've missed.
nxobject 57 days ago [-]
If you want the least useful macOS commandline utility, 'pdisk' is:
"...a menu driven program which partitions disks using the standard
Apple disk partitioning scheme described in "Inside Macintosh: Devices".
It does not support the Intel/DOS partitioning scheme[.]"
terminaltrove 57 days ago [-]
Although not built in, we have a list of easy to install command-line utilities for macOS.
You might find one you've never heard of that is useful! :)
sureIy 57 days ago [-]
Kinda related: does anyone else regularly finds CLI tools, installs them and never ever even call them once?
downrightmike 57 days ago [-]
That's the difference between recall memory and recognition memory. The GUI took off because we can recognize a menu and easily figure out where we need to go, versus having to memorize obscure and cryptic commands. Honestly having a LLM spit out command line arguments is probably the best way forward if things don't have a GUI.
51 days ago [-]
miguno 56 days ago [-]
Yes, been there, forgot that. I have since created a shell helper function that prints a list of "new and cool" CLI tools that I recently added to my dotfiles setup, which helps me committing them to long-term memory.
adriand 56 days ago [-]
It happens but Ctrl-R has helped me get much better at finding commands I’ve used even just once before based on some tiny thing I remember about them.
blacksmith_tb 57 days ago [-]
Ha, when I search through my history I usually find I ran them exactly once, right after installing, and then forgot all about them. But there are some exceptions, I often use httpie instead of curl, MTR is great, I am liking doggo instead of dig...
irskep 57 days ago [-]
This looks like a list of cross-platform command line tools. What about it is Mac-specific?
dhruvkb 57 days ago [-]
I found a tool of mine submitted by someone else on the site (pleasant surprise!) and I want to update the description and add a more recent/better image. How would I do that?
terminaltrove 57 days ago [-]
Send us a message, we will update it very quickly!
To get a complete list of parameters, you can execute
defaults read
__m 57 days ago [-]
$ say Hello
To scare your teammates when you are logged in remotely
optionally with
$ osascript -e "set volume output volume 100"
lagrange77 57 days ago [-]
Not a command, but a little known feature of the Terminal app:
(shift+command+K) or Menu 'Shell' -> 'New Remote Connection...'
opens a SSH, S(FTP), TELNET connection manager window!
FabHK 57 days ago [-]
And sometimes handy: shift+cmd+. to toggle showing hidden (dot) files in Finder.
e40 57 days ago [-]
Sort of like command+k in the Finder, connects to a server. You can type in vnc://host or vnc://localhost:port... the latter is for VNC to hosts via an SSH tunnel.
It's quite a good VNC client, too.
msanlop 56 days ago [-]
It's too bad this doesn't use .ssh/config
l33tman 57 days ago [-]
As they seem to have removed Bluetooth Explorer and all ways to get diagnostic info about the bluetooth system and/or change codecs and settings, does anybody know any good cmdline ways in later mac osxes to do the same?
For example I'm having a problem that comes and goes now and then where Bluetooth audio is 300 ms delayed compared to the video playback everywhere except in Youtube on Safari, very strange. It's good for a few months then suddenly it becomes unusable, then back to zero sync delay after a few months.
I was thinking this might be related to CODEC selections etc or some hidden setting that might get changed which we normally aren't allowed to determine :)
(btw I know there is a difference between latency and synchronization - latency might be unavoidable but video sync should always be able to compensate - I got curious on how exactly that works, where in the app / SDK / OS pipeline does the a/v sync happen on a Mac?)
Thanks.. but that github program only lists the same info you get if you command-click on the BT icon in the menu bar. It basically only shows the device name.
I guess filtering the streaming log entries in the Console app gives some info.
runjake 57 days ago [-]
More:
nc(1) - netcat, arbitrary TCP and UDP connections and listens
networkQuality - Speed test + network stress tool.
system_profiler(8) - Useful way to grab extensive system information in shell scripts.
wdutil(8) - wdutil provides functionality of the Wireless Diagnostics application in
command line form.
throwaway314155 56 days ago [-]
networkQuality is in the article.
cantSpellSober 57 days ago [-]
TinkerTool provides a GUI that runs some useful commands under the hood
I have thousands of old photos that preview can open, but I can’t upload them into the photo.app because the file format is wrong. I’m going to try and use SIPS to convert them all into png first and then add to photo.app. Thanks for this pointer.
FabHK 57 days ago [-]
Similarly, I've had trouble getting audio files into a format that the Books app understands (for ebooks), until I found
afconvert -v -s 3 -f m4bf filename.mp3
jftuga 57 days ago [-]
Nice. After reading the man page, I see that it can be used to convert image file formats:
sips -s format png photo.HEIC --out photo.png
or resizing:
sips -z 300 600 original.jpg --out new.jpg
yen223 57 days ago [-]
sips looks really cool, thanks for pointing this out.
Not gonna lie, I missed this because I thought it was related to macOS SIP, System Integrity Protection. Which is something I am deeply uninterested in.
hk1337 57 days ago [-]
That's cool. I wish it could convert webp images.
latexr 56 days ago [-]
It can, but only from webp, not to.
huskyr 57 days ago [-]
I've never heard of networkQuality, that's seems like quite a useful tool.
latexr 57 days ago [-]
For reference, it’s been there since macOS 12. You may also like to know that this year (macOS 15) they added jq.
huskyr 57 days ago [-]
I didn't know that, thanks!
dmd 57 days ago [-]
Unfortunately, it's not actually very useful, as whatever server they're using on the other end is severely constrained. networkQuality gives me:
whereas speedtest (whether to the official speedtest server OR a friend's home server in their basement!) gives ~700 Mbps uplink.
lladnar 57 days ago [-]
try
networkQuality -s
That's a more apples to apples comparison to speedtest.net; Separate upload and download tests.
dmd 57 days ago [-]
Somewhat better, 867/114, but still not the symmetric I get on typical real workloads.
tzs 57 days ago [-]
Here's a handy use I've found for mdfind.
Say you've got a directory that has scripts or data files related to some thing you do. For example I've got several scripts that I use when I scan books with my book scanner. I only need these when doing book scanning stuff so don't want to put them somewhere in $PATH. I want to be able to easily run them from scripts that aren't in that directory, but I don't want to hard code the path to that directory.
Solution: in the directory with the book scanning scripts I make a file named ID that contains a unique string. I currently use 16 byte random hex strings [1].
I have this script, named find-dir-by-ID, somewhere in $PATH:
#!/bin/zsh
ID=${1:?Must specific ID}
IDSHA=`echo $ID | shasum | cut -d ' ' -f 1`
mdfind $ID 2>/dev/null | grep /ID | while read F; do
FSHA=`shasum $F | cut -d ' ' -f 1`
if [ $IDSHA = $FSHA ]; then
dirname $F
exit 0
fi
done
exit 1
If some script wants to use scripts from my book scanning script directory, it can do this:
SCRIPT_DIR=`find-dir-by-ID 54f757919a5ede5961291bec27b15827`
if [ ! -d $SCRIPT_DIR ]; then
>&2 echo Cannot find book scanning scripts
exit 1
fi
and then SCRIPT_DIR has the full path to the scanning script directory.
The IDs do not have to be hex strings. If I'd thought about it more I probably would have made IDs look like this "book-scanning:54f757919a5ede59" or "arduino-tools:3b6b4f47bf803663".
[1] here's a script for that:
#!/bin/sh
N=${1:-8} # number of bytes
xxd -g $N -c $N -p -l $N < /dev/urandom
jeffhuys 57 days ago [-]
Why not just a directory with subdirectories by ID? No mdfind needed, no problems with just-created directories, no wait, etc
tzs 57 days ago [-]
You mean something like having ~/well-known-stuff and under that having a 54f757919a5ede5961291bec27b15827 directory with the book scanning scripts and so on?
That could work fine, but generally the directories I've used this on are directories that I want to have somewhere else, and with a reasonable name. Usually the directories came first and various other things in fixed relative positions were using them, and then later I wanted to use them from elsewhere and added the ID.
I suppose ~/well-known/stuff/54f757919a5ede5961291bec27b15827 could by a symbolic link to the original.
The mdfind approach does have the advantage that if I reorganize things and move the directory it keeps working.
SuperNinKenDo 55 days ago [-]
Beyond opaqueness, which could be overcome by simply prefixing the ID with something descriptive, I guess it helps avoid creating excessively long paths that might create problem onncertain filesystems, which is rarely a problem these days, but I have been bitten by it a half dozen times over the last few years. In a couple instances causing (recoverable) data loss.
I've found reliably "turning on" with pmset to be hit or miss. I can't remember the gotcha I ran into if it was that you had to have your laptop lid open or something else...
Bengalilol 56 days ago [-]
Yes. If macOS is asleep or idle, pmset won't get triggered. It is best used with caffeinate.
I used it for a museum installation where every night I'd turn it off before they cut the electricity and turn it on in the morning just after electricity is switched back on: it was a way for me to be in peace with my conscience (though after some tests, the mac didn't bother getting switched off by cutting out the electricity).
xpe 57 days ago [-]
My non-built-in CLI utility recommendations, none of which are macOS specific:
since I switch between linux and macos a lot I wrote a dotfile function called "clip" that will work the same on both. nice thing is it will automatically paste if nothing is piped to it to copy so there's no need to use separate commands... although I just realized it might be nice to have a "passthrough" mode that both copies and pastes if you add this to a pipeline in order to capture some intermediate part to the clipboard
if [[ "$(uname)" == "Darwin" ]]; then
clip() {
[ -t 0 ] && pbpaste || pbcopy
}
else # assume linux if not macos
clip() {
[ -t 0 ] && xclip -o -selection clipboard || xclip -selection clipboard
}
fi
gkfasdfasdf 57 days ago [-]
That's handy, thanks! `osc copy` may also take args for files to copy to the clipboard, but in the absence of that and no data on stdin it maybe should switch to paste.
hk1337 57 days ago [-]
I went the route of managing a different set of dotfiles for linux and macOS. Same repository, just different branches.
Also, falling back to using oh-my-zsh functionality.
pak9rabid 57 days ago [-]
At my job I have to work with a lot of JSON that's usually minimized. This command has single-handedly saved my sanity:
$ pbpaste | jq | pbcopy
Then I can paste it into whatever text editor I want and it's all nice & pretty-printed for me.
Bonus is that I don't have to change the command at all, just copy the minimized JSON to the clipboard (say from DBeaver, for example), then hit the 'up' arrow and enter.
mfonda 57 days ago [-]
I never knew that jq without any arguments pretty-printed JSON. Very useful, and great tip to combine with pbcopy/pbpaste.
DvdGiessen 56 days ago [-]
Copying using OSC52 is great! I have a cross-platform shell function for that in my bashrc [1], as well as an implementation that works in vim [2].
I copied this functionality to linux it's been so useful.
jasoneckert 56 days ago [-]
And for those of us who have to support macOS users:
sw_vers (to display the version/build of macOS),
dsenableroot (to enable the root user), and
say "phrase" (useful for freaking out users over a remote SSH connection)
urbandw311er 57 days ago [-]
Great tip about the `security` command, a new one for me.
BasilPH 57 days ago [-]
I got this trick from someone on the Internet:
$> long_running_command && say "Witness me, for I am done"
jfb 57 days ago [-]
Yep, I do this in a tmux session. But sometimes I'm on a call and forget and the ROBOT VOICE says "DATABASE DUMP IS COMPLETE" and I jump out of my skin.
RandallBrown 57 days ago [-]
A fun easter egg in the "say" command is that "OS X" is said as "Oh Ess Ten".
You can also change voices with -v. My favorite is "cellos" since it sings to you.
robertoandred 57 days ago [-]
Not sure that's an easter egg? That's been the pronunciation for 25 years.
mholm 57 days ago [-]
It's at least manually programmed in. Otherwise it would have said 'Ecks'
staplung 57 days ago [-]
It actually understands roman numerals, to a certain extent. E.g. `say LVIII` will say "58". However, `say MCMLXXIX` speaks some gibberish that ends in the word "six", for some reason.
It also knows how to say numbers up into the trillions but not more than that (although I feel like it used to).
ramses0 57 days ago [-]
Other cute `say` tricks: muck around with OSX Default Speech Voice (to a siri-ish voice) and you can invoke that from the CLI.
I hacked together a little script for demo recording like:
START_FROM="$1"
STARTED=0
function transcript() {
ID="$1"
TO_SAY="$2"
if [[ ...STARTED || START_FROM && ID... ]]; then
STARTED=1
say "$TO_SAY"
fi
}
transcript "STEP001" "This is a test"
transcript "STEP001b" "of the emergency broadcast system"
transcript "STEP002" "This is only a test, if this was ..."
transcript "STEP003" "...etc..."
...and then I have a hardcoded `--output` which will then change the invocation to `say -o "$ID.wav" "$TO_SAY"` and output audio files.
That way I can iterate on voiceover scripts, eg: `./demo-script "STEP002"` => `./demo-script --output`
It's really helpful for iterating on pronunciations, eg: `transcript "STEP005" "In case of Four Hundred and Four errors..."`, I can just "skip to" and iterate against that line (and subsequent ones), or "skip back" and hear it in more of a flowing context.
...even if I don't end up using the `say`-generated audio, having a transcript (and even pacing) that I can just read through with my own voice is super helpful.
chasil 57 days ago [-]
Since Apple spent so much effort in getting certified:
(I may not have linked to the precisely correct version.)
hk1337 57 days ago [-]
plutil. Maybe not that useful to a lot of people but I have been going through and collecting bookmarks and Safari bookmarks are binary files. plutil is a means of converting the binary property file to a json or xml file.
I set a shell alias so I can just do `airport -s`. I've no idea why this is hidden away inside some framework and not in a directory which is in the normal path, but there you go.
stunthamsterio 57 days ago [-]
FWIW that appears to be soon deprecated according to MacOS 15.2:
WARNING: The airport command line tool is deprecated and will be removed in a future release.
For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
semanticist 57 days ago [-]
Oh, that's a pity. I'm pretty bad at keeping up to date on MacOS releases, but I should probably start figuring out `wdutil` so that my muscle memory is adapted before I've got no choice!
WorldPeas 57 days ago [-]
is there a way to do monitor mode scanning with wdutil like the `airport -s` command? asking for a friend...
reaperducer 57 days ago [-]
mdls shows a file's metadata.
I use it most often for pulling lat lon data from photos.
onnimonni 57 days ago [-]
What I'm really missing still is a cli to iCloud stored passwords. AFAIK 'security' cli can't access the credentials stored in the cloud. This would be helpful to store secrets outside of git but would still allow scriptable access to them similarly as 1password cli 'op' has.
amai 56 days ago [-]
Time Machine utility, examine and manipulate Time Machine backups, restore data from backups, add or remove exclusions, and compare backups
I'm fascinated by "sips" which has a full JavaScript interpreter built into it for rendering images using an entirely undocumented (as far as I can tell) Canvas-like API: https://til.simonwillison.net/macos/sips
Doctor_Fegg 57 days ago [-]
fs_usage is my favourite - find out what's thrashing the disk. (Usually Spotlight or Spark...)
noja 57 days ago [-]
Does anyone remember the shortcut that brings up a list of currently available keyboard shortcuts for the current app? It may not be built-in, in which case it was a free utility.
leecoursey 57 days ago [-]
Cheatsheet? I've used it for years. Just hold down Command for a few seconds to see a list of all available shortcut keys in the current app.
Looks like a lot of these have linux equivalents that could be aliased. I wonder if anyone's made a set of those for regular macos users who occasionally use something else.
adolph 57 days ago [-]
> If you store your secrets in the Keychain (and you should!)
As part of the OS, Keychain suffers from the same sorts of sharp edges as using a built-in interpreter. An alternative is to use a password manager. Below is an example of the tools available in one.
Would you mind expanding on what these "sharp edges" are that you're warning about? I'm not really sure what you mean by this. Keychain has served me (and I imagine many others) really well for a while.
locate searches a database for all pathnames which match the specified pattern.
The database is recomputed periodically, (about once a week) and contains the path-names of all files which are publicly accessible.
emmelaich 57 days ago [-]
The database is not set up by default.
Your better bet on MacOS is to use `mdfind -name ....`
kstrauser 57 days ago [-]
I have that aliased to `locate` on mine. It's not exactly the same but it gets me 99% of the way there.
dhosek 56 days ago [-]
I just remembered at a previous job where we were always paired and used team rather than individual iMacs for development that as a prank I ssh’d into the other iMac from my team and periodically would run open on a random URL which caused a Safari window to mysteriously pop up their system.
wodenokoto 56 days ago [-]
pbcopy and pbpaste are among my top commandline utilities. If you are running linux in WSL, you can add the following to you path to recreate their functionality:
# pbpaste
#!/bin/bash
# Adapted from https://www.techtronic.us/pbcopy-pbpaste-for-wsl/
powershell.exe Get-Clipboard | sed 's/\r$//' | sed -z '$ s/\n$//'
exit 0
and
# pbcopy
#!/bin/bash
#Adapted from https://www.techtronic.us/pbcopy-pbpaste-for-wsl/
<&0 clip.exe
exit 0
BossingAround 57 days ago [-]
I'm sure everyone knows this, but `open` has an equivalent on Linux: `xdg-open`.
Affric 57 days ago [-]
Except xdg mime types are easily heist-able by programs and there is no universal truth for it.
Install vscode on Linux and have fun with it hijacking opening directories. Which is easy enough to fix (with a bit of know how) or work around but annoying.
MacOS is far from perfect but open always doing what I expect is a good example of what Apple did well.
yen223 56 days ago [-]
Xcode opening all my JSON files is equally obnoxious. At least it is relatively easy to sort that out in macOS.
yes amphetamine I use regularly when I want to charge my android phone during travel with lid closed.
walthamstow 57 days ago [-]
That's interesting, I have never needed to do that. My Pixels have always just charged even if the lid is closed, on Intel and Apple Silicon machines. I like to travel light so I often use my laptop as a battery bank instead of carrying a seperate one.
vallode 57 days ago [-]
Indeed, many applications I would expect to prevent sleeping (some audio playback ones, games, etc.) don't implement this. I assume it's a case of Apple's APIs changing over the years and not everyone catching up/caring. At one point I had downloaded Amphetamine[^1] but it is much nicer to just use the terminal here.
I was able to install a `caffeine` package with Apt on Linux. In that one the `caffeinate` command is supposed to be run with another command. While the `caffeine` command does what macOs `caffeinate` does.
al_borland 57 days ago [-]
While it may avoid sleep, it doesn’t prevent inactivity, in my experience. For instance, my chat app at work will still show me inactive while running caffeinate. I have to do non-interactive training semi-regularly and need to interact to keep from looking like I’m away from my desk.
latexr 57 days ago [-]
Have you used the `-u` flag? From the manual:
-u Create an assertion to declare that user is active.
mathieuh 57 days ago [-]
Doesn’t work with Slack at least. I’ve had an iTerm window running `caffeinate -disu` for years. I think it used to work and stopped working in the last few months.
weberer 57 days ago [-]
It would be cool to have this activate when a Jupyter notebook is currently running a cell, and deactivate automatically when its finished.
eszed 57 days ago [-]
This can be done by passing a PID. I believe there are other options, as well. (Not at my computer to look it up right now.) I haven't used those features "manually", but I have in scripts that I expect to generate long-running processes.
dozzman 56 days ago [-]
There is also 'say' which is great if you need to step away from a long running command, in a similar fashion to ringing the terminal bell but with more context.
throwaway314155 56 days ago [-]
That's in there.
pantulis 57 days ago [-]
afconvert is pretty nifty for audio format conversion.
So if your needs are just "one audio file in, one audio file out, and let me tell you exactly what it should look like", then afconvert is probably what you want.
Love those type of OG Mac indie software.
I prefer to encode with afconvert on the command line because it gives me a few more options for tweaking things, that I don't have access to in iTunes (or "Music" as it's called these days). Additionally, I use a simple shell script that handles all of it when for example ripping a whole CD.
Oh wow! A while back I ripped some concert audio from Youtube, but it was too large for me to sync using my `iTunes Match`. I've been too lazy to figure out how to downsample it juuuuust enough. But it looks like this works right out of the box
If you're wondering how one implementation of an audio codec could be superior to others — mostly, it's because any lossy audio codec has an encoding phase called "psychoacoustic compression", where each implementation of the codec is free to do whatever it likes to "simplify" the waveform in some way (most easily pictured: by taking a Discrete Cosine Transform of the waveform, and then quantizing / convoluting some parts of the frequency space. Like what JPEG does to discard information from the chroma channels.)
IIRC, rather than blunt-force quantization, Apple's AAC encoding does clever things (akin to the instrument separation done to audio in Melodyne) to split the waveform into "features", and then discards information in such a way that the features' separability is maintained (i.e. it doesn't become harder to "pick out" any given "sound" from the audio.)
You are using Opus on most VoIP/call providers.
Meanwhile, AAC, MP3, OGG... are history today.
No. Opus support in the PSTN is still unfortunately almost non-existent. Adoption is growing but the pace is very slow. Source: me, working in the European telecommunications industry for over a decade, specializing in telephony and SMS.
I like opus on VLC for youtube-dl rips but if I’m buying music I want lossless uncompressed.
Way back then (iPod era), I made an exposé for a science exam (small paper), proving that AAC was indeed better than MP3 both subjectively and objectively at most bitrates. This is how I got introduced to Fourier transforms and the likes; it was very interesting to see that you can literally "see" the difference in quality on the encoded waveform output.
But I just used the default encoders on the Mac and I didn't think about going in deep into encoder comparisons at the time. Does it matter that much? From what I know, it just about properly programming a math spec, with some tricks but I wonder if that makes that much of a difference.
In any case, above 256kbps it takes a very skilled listener to correctly identify encoded music. Apple has some useful tools for that, particularly AU Lab that allows you A/B testing of tracks with on-the-fly encoding. https://www.apple.com/apple-music/apple-digital-masters/
> Does it matter that much? From what I know, it just about properly programming a math spec, with some tricks but I wonder if that makes that much of a difference.
It does matter a lot and the difference can be staggering. Producing the audio bitstream is a case of both effectively analyzing the original input and programmatically expressing the waveform as correctly and as efficiently possible. Two excellent examples: the old MP3 encoder Xing, which compared to LAME produces very poor material even at higher bitrates, and one of the earliest open-source AAC encoders, FAAC, which also renders a very poor product. A lot of "early adopters" got bitten by FAAC and many of them still stubbornly cling to the misunderstanding that AAC is a worse format than MP3.
I have used Macs since my youth and used iTunes before it was even called that, so encoder quality was never a problem I had. I guess I'll revisit the topic more deeply one of these days, still not that keen on that much math though.
Incorrect. The specification only concerns the bitstream and the decoding. Encoders are free to do whatever they want, as long as they produce a valid bitstream.
Of course, the implementations are going to have varying performance depending on code quality/optimisations but that's a given.
Edit: some other poster gave some cues to my question. I guess you can do some trickery by decomposing the waveform before encoding and recomposing it.
I'll read more on the specs.
You are deluded, then. Or deaf. Most MP3 podcasts at 128 KBPS sound worse than an OPUS file @64.
See also XACT[1]. It's a macOS GUI, but it's nerd-friendly.
[1] http://xact.scottcbrown.org
open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).
caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.
You can use it to pass a pid to keep the computer awake until that process completes. I use it for longer-running scripts that I don't want interrupted
open -a <GUI Application> <File>
Handy for distinguishing between editing and consuming media.
Standard apps usually just need the name, like Finder and Safari but you can also specify the path "/Applications/DifferentFinder.app"
I guess you could do that centrally with some sort of database but that would open another can of worms; and most importantly you wouldn't be able to transfer a folder and keep its Finder presentation intact.
Nowadays it's not as useful because of the App Store but when software was only released as .dmg images, it became expected to open a nice layout with graphics presenting the app and a shortcut to the App folder that you would drag'n'drop the app bundle to.
This presentation relies of .DS_Store to work.
There are some other use cases like that, it all comes down to a simple fact: Apple has always cared a lot more about how things look than Microsoft ever did, this is a perfect example.
Of course, they could rethink the whole thing but the point is that it's a legacy thing and at this time it's not worth dedicating much ressource to a solve problem just to remove some mostly invisible files (on UNIXs). It's really easy to have scripts to cleanup for sharing to outside world, even some zip utilities do that automatically.
It can be annoying but it's really not a big deal, I doubt they could come up with something much better while still preserving the functionality and not making another complicated/convoluted proprietary folder format that wouldn't transfer any better to Windows...
It is just the first time the .DS_Store file is needed is often when the folder is touched by Finder.
I think Windows is right in that matter...
My poor workaround is to use osascript: `tell application "System Events" to set frontmost of process "Finder" to true`
Not mine (found online years ago), but here's the opposite. `cd` into the frontmost Finder window:
(Uses built-in macOS capabilities for transcription from audio to text.)
Man page at https://sveinbjorn.org/files/manpages/hear.1.html
> (Uses built-in macOS capabilities for transcription from audio to text.)
Question (to self, currently researching)... Which capabilities? Released when? I ask because Apple Intelligence has expanded the use of audio transcription features.
Answer: `hear` uses SFSpeechRecognizer [1] which has been available since macOS 10.15. I'm not yet sure how it relates to Apple Intelligence transcription services.
Note: "speech recognition is a network-based service" which perhaps suggests Apple Intelligence (the marketing term, not an Apple Developer term, I don't think) uses it as well
[1][ https://developer.apple.com/documentation/speech/sfspeechrec...
> hear not found
macOS 15.1
> hear is a command line interface for the built-in speech recognition capabilities in macOS
Have you gone through the installation process? https://github.com/sveinbjornt/hear?tab=readme-ov-file#insta...
https://ss64.com/mac/say.html
Docs are at https://ss64.com/mac/diskutil.html
Apple promotes Swift heavily but the results are not really encouraging. I don't think the "so-so" results are entirely because of Swift (probably due to newer, less battle tested software and also newer/younger devs) but still the fact is, all the not-so-great new software from Apple came with Swift rewrites, hard to not make a connection...
https://www.reddit.com/r/mac/comments/18ez5b0/why_disk_utili...
It's a bit sad because the whole point of Apple was, "we are not IBM" after the PC got its start. They are very much IBM now.
As for ZFS, it has its use for sure (servers) but it's very heavy on ressource and very complex. I don't think it's just because of the buyout of Sun, overall, it's just overkill for a personal computer; and since Apple completely left the server market, even for SMBs, there is no real reason to push for it.
In the end it's not really about any filesystem, the problem is mostly that Apple is not a user focused company as much as it used to be. They could make better technical UI/Apps/Solutions but they don't care that much, they make too much money selling gadgets (those are good but really not the same thing as "proper" computers).
I guess the rational is that if you have a Mac you also have an iPhone and your important data is already on your phone and thus already in a backup.
In theory they also have a file history for iCloud and you could restore files for up to 30 days, I think. I say in theory because the few times I have tried it, it was incredibly unhelpful. But that's pretty much usual with Apple, the practice is actually very far for the theory/marketing.
That's a leap, but I understand your point of course. It _MIGHT_ also be said it all came from ObjectiveC experts having a first go at Swift, too. Or from groups that were run by some common set of "get it out the door" middle management types.
Or any of a thousand reasons.
And of course, Apple has a middle management problem, but that comes with Tim Cook's style; he cares about values that are just not conductive to progress and excellence. It all ends up about "getting shit done" and not caring that much if the results are actually any good. So, they do stuff on schedule and are content with it no matter how bad it is, typical careerist behavior.
To be fair, a lot of our modern society seems to have been overtaken by these types of people, they are very popular and very "successful"; it's more noticeable at Apple because it used to be very different...
https://manpagez.com/man/8/pdisk/
I still get a ton of mileage from reading the macOS How-to page https://ss64.com/mac/syntax.html
https://terminaltrove.com/categories/macos/
You might find one you've never heard of that is useful! :)
https://terminaltrove.com/about/
For me, increasing the number of icons in the launcher grid was very useful.
After running these three commands, the size of the Launcher will be set to 13x8 apps:
In general, a lot of parameters of different applications can be changed via command `defaults`https://macos-defaults.com/
To get a complete list of parameters, you can execute
To scare your teammates when you are logged in remotely optionally with
$ osascript -e "set volume output volume 100"
(shift+command+K) or Menu 'Shell' -> 'New Remote Connection...'
opens a SSH, S(FTP), TELNET connection manager window!
It's quite a good VNC client, too.
For example I'm having a problem that comes and goes now and then where Bluetooth audio is 300 ms delayed compared to the video playback everywhere except in Youtube on Safari, very strange. It's good for a few months then suddenly it becomes unusable, then back to zero sync delay after a few months.
I was thinking this might be related to CODEC selections etc or some hidden setting that might get changed which we normally aren't allowed to determine :)
(btw I know there is a difference between latency and synchronization - latency might be unavoidable but video sync should always be able to compensate - I got curious on how exactly that works, where in the app / SDK / OS pipeline does the a/v sync happen on a Mac?)
Also: https://github.com/toy/blueutil
I guess filtering the streaming log entries in the Console app gives some info.
https://www.bresink.com/osx/0TinkerTool/download.php
I do this with man pages but it opens up in a full Preview window, not QuickLook.
coreaudiod is using very high CPU at 111.90 ms/s
I'm on a 16" M1 Macbook Pro 16 gig.
Maybe they are using it "wrong" but Apple Music isn't exactly light on ressource either...
/usr/bin/plutil -extract your.key.path raw -o - - <<< "$jsoninput"
(obviously, less useful now that `jq`is built in)
Glad to spread the good word ;)
Hold up, what?
https://archive.is/kGmn6
Not gonna lie, I missed this because I thought it was related to macOS SIP, System Integrity Protection. Which is something I am deeply uninterested in.
Downlink: 884.856 Mbps, 198 RPM - Uplink: 13.238 Mbps, 198 RPM
whereas speedtest (whether to the official speedtest server OR a friend's home server in their basement!) gives ~700 Mbps uplink.
Say you've got a directory that has scripts or data files related to some thing you do. For example I've got several scripts that I use when I scan books with my book scanner. I only need these when doing book scanning stuff so don't want to put them somewhere in $PATH. I want to be able to easily run them from scripts that aren't in that directory, but I don't want to hard code the path to that directory.
Solution: in the directory with the book scanning scripts I make a file named ID that contains a unique string. I currently use 16 byte random hex strings [1].
I have this script, named find-dir-by-ID, somewhere in $PATH:
If some script wants to use scripts from my book scanning script directory, it can do this: and then SCRIPT_DIR has the full path to the scanning script directory.The IDs do not have to be hex strings. If I'd thought about it more I probably would have made IDs look like this "book-scanning:54f757919a5ede59" or "arduino-tools:3b6b4f47bf803663".
[1] here's a script for that:
That could work fine, but generally the directories I've used this on are directories that I want to have somewhere else, and with a reasonable name. Usually the directories came first and various other things in fixed relative positions were using them, and then later I wanted to use them from elsewhere and added the ID.
I suppose ~/well-known/stuff/54f757919a5ede5961291bec27b15827 could by a symbolic link to the original.
The mdfind approach does have the advantage that if I reorganize things and move the directory it keeps working.
https://ss64.com/mac/pmset.html
* atuin - TUI for shell history, backed by SQLite - https://github.com/atuinsh/atuin
* LSD (LSDeluxe) - rewrite of `ls` - https://github.com/lsd-rs/lsd
* ripgrep - https://github.com/BurntSushi/ripgrep
* fzf - command-line fuzzy finder that enhances file search, command history search, and more - https://github.com/junegunn/fzf
Notes:
- To get pretty extra file/folder symbols with LSD, you'll probably need to install some special fonts.
- You can use `fzf` and `ripgrep` together.
Also, falling back to using oh-my-zsh functionality.
$ pbpaste | jq | pbcopy
Then I can paste it into whatever text editor I want and it's all nice & pretty-printed for me.
Bonus is that I don't have to change the command at all, just copy the minimized JSON to the clipboard (say from DBeaver, for example), then hit the 'up' arrow and enter.
[1]: https://github.com/DvdGiessen/dotfiles/blob/2c02332b4a657690... [2]: https://github.com/DvdGiessen/dotfiles/blob/2c02332b4a657690...
$> long_running_command && say "Witness me, for I am done"
You can also change voices with -v. My favorite is "cellos" since it sings to you.
It also knows how to say numbers up into the trillions but not more than that (although I feel like it used to).
I hacked together a little script for demo recording like:
...and then I have a hardcoded `--output` which will then change the invocation to `say -o "$ID.wav" "$TO_SAY"` and output audio files.That way I can iterate on voiceover scripts, eg: `./demo-script "STEP002"` => `./demo-script --output`
It's really helpful for iterating on pronunciations, eg: `transcript "STEP005" "In case of Four Hundred and Four errors..."`, I can just "skip to" and iterate against that line (and subsequent ones), or "skip back" and hear it in more of a flowing context.
...even if I don't end up using the `say`-generated audio, having a transcript (and even pacing) that I can just read through with my own voice is super helpful.
https://www.opengroup.org/openbrand/register/
These are all guaranteed to work:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/
(I may not have linked to the precisely correct version.)
https://keith.github.io/xcode-man-pages/plutil.1.html
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
I set a shell alias so I can just do `airport -s`. I've no idea why this is hidden away inside some framework and not in a directory which is in the normal path, but there you go.
WARNING: The airport command line tool is deprecated and will be removed in a future release. For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
I use it most often for pulling lat lon data from photos.
https://ss64.com/mac/tmutil.html
But I don’t have uuidgen!
https://www.mediaatelier.com/CheatSheet/feedNotes.php
https://formulae.brew.sh/cask/cheatsheet
As part of the OS, Keychain suffers from the same sorts of sharp edges as using a built-in interpreter. An alternative is to use a password manager. Below is an example of the tools available in one.
https://developer.1password.com/docs/cli/get-started/#step-1...
networksetup was one of my favourites as well as du and caffeinate.
The 'security' command is new to me so thanks!
locate searches a database for all pathnames which match the specified pattern. The database is recomputed periodically, (about once a week) and contains the path-names of all files which are publicly accessible.
Your better bet on MacOS is to use `mdfind -name ....`
Install vscode on Linux and have fun with it hijacking opening directories. Which is easy enough to fix (with a bit of know how) or work around but annoying.
MacOS is far from perfect but open always doing what I expect is a good example of what Apple did well.
Super easy to fix on macOS.
Very useful.
[^1]: https://apps.apple.com/us/app/amphetamine/id937984704
[1] https://github.com/BlueM/cliclick
might
Sigh. These are shell commands, not "Bash commands".