Readit News logoReadit News
daneel_w · a year ago
A couple more:

    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
Examples:

    afconvert in.wav -o out.m4a -q 127 -s 2 -b 160000 -f m4af -d 'aac '

    mb=300; diskutil eraseVolume APFS myramdisk `hdiutil attach -nomount ram://$((mb*2048))`

derefr · a year ago
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 · a year 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 · a year 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 · a year ago
+1 to XLD. I have been using it for years, it's a wonderful piece of software.
jghn · a year 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 · a year 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 · a year 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.)

kps · a year 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 · a year 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 · a year 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 · a year ago
How does that compare with ffmpeg? The arguments seem about the same.
krackers · a year 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.
daneel_w · a year 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.
petecooper · a year ago
> afconvert

See also XACT[1]. It's a macOS GUI, but it's nerd-friendly.

[1] http://xact.scottcbrown.org

vbezhenar · a year ago
Few additions.

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 · a year 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 · a year ago
That's mostly what `caffeinate your-script` is for.
1ncorrect · a year ago
I use this all the time:

open -a <GUI Application> <File>

Handy for distinguishing between editing and consuming media.

wwader · a year ago
open -a is nice, i use it with alias, ex:

  alias qt='open -a "quicktime player"'
  alias vlc='open -a "vlc"'

FabHK · a year 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>
troupo · a year 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 · a year 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 · a year ago
`open .` works for me too
nextos · a year 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.
luckman212 · a year 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 · a year ago
you can just

    open .
unless you've reconfigured something else to open directories, which most people haven't.

ilyagr · a year ago
You can also `open -R file` to select that file in Finder.
seec · a year 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 · a year 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 · a year ago
Apparently, it does. There is a -g flag (background) to prevent focus.
justletmein · a year ago
Isn’t open opening apps in the background a consequence of having “secure keyboard entry” enabled in Terminal.app?
alsetmusic · a year 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 · a year ago
You mean `open .`
sneak · a year ago
You can also just drag the proxy icon onto the terminal window for its path, ie “cd “ <drop>, enter.
impalallama · a year ago
caffeinate -d is incredibly useful for work... uh reasons
JasserInicide · a year 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 · a year ago
I would like to also recommend the app:

   hear (macOS speech recognition and dictation via the command line)
See: https://sveinbjorn.org/hear

(Uses built-in macOS capabilities for transcription from audio to text.)

xpe · a year ago
Its open source GitHub repo at https://github.com/sveinbjornt/hear

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

e40 · a year ago
I thought I recognized the name of the developer! The person that brought us Platypus! Nice.
alsetmusic · a year 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 · a year ago
> which hear

> hear not found

macOS 15.1

avernet · a year ago
Someone needs to create a brew formula for `hear`.
avtar · a year ago
Hear itself isn't a built-in utility.

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

dmix · a year ago
Same, but there is the `say` command which you can cat a text file into and it will say it outloud

https://ss64.com/mac/say.html

zitterbewegung · a year ago
The terminal version of Disk Utility is actually much better than the GUI (it doesn't hang and the app is glitchy.

Docs are at https://ss64.com/mac/diskutil.html

seec · a year ago
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 · a year 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 .

https://www.reddit.com/r/mac/comments/18ez5b0/why_disk_utili...

michaelcampbell · a year 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.

zazaulola · a year ago
`pdisk` might be more convenient if you've worked with `gdisk` on ArchLinux

https://manpagez.com/man/8/pdisk/

Tsiklon · a year ago
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.
e40 · a year ago
diskutil does more than edit partitions, though.
e40 · a year ago
Or "man diskutil"
doodpants · a year ago
This article contains links to https://ss64.com/ , which is an amazing resource that I wish I'd known about sooner!
yen223 · a year ago
100% That's why I made it a point to share that page.

I still get a ton of mileage from reading the macOS How-to page https://ss64.com/mac/syntax.html

ss64 · a year ago
Thanks for the kind words, I'll be scanning this thread to see if there's anything new that I've missed.
nxobject · a year 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 · a year ago
Although not built in, we have a list of easy to install command-line utilities for macOS.

https://terminaltrove.com/categories/macos/

You might find one you've never heard of that is useful! :)

sureIy · a year ago
Kinda related: does anyone else regularly finds CLI tools, installs them and never ever even call them once?
downrightmike · a year 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.
miguno · a year 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 · a year 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 · a year 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 · a year ago
This looks like a list of cross-platform command line tools. What about it is Mac-specific?
dhruvkb · a year 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?

Dead Comment

mcc1ane · a year ago
Related - https://news.ycombinator.com/item?id=36491704 "macOS command-line tools you might not know about"