[HN Gopher] macOS Command Line
___________________________________________________________________
macOS Command Line
Author : animal_spirits
Score : 236 points
Date : 2022-12-07 16:39 UTC (6 hours ago)
(HTM) web link (git.herrbischoff.com)
(TXT) w3m dump (git.herrbischoff.com)
| Aperocky wrote:
| here's the magic line in .*rc that you didn't know you need:
|
| `set -o vi`
|
| It applies vi rules to your command line.
| mdaniel wrote:
| Or its more sane friend, control-x+control-e to launch $EDITOR
| with a file in $TMPDIR containing the current command-line, and
| then execute it when $EDITOR exits. BTW, I don't mean "$EDITOR"
| as a placeholder for whatever editor is your favorite, I quite
| literally mean the shell variable "EDITOR". Strictly speaking,
| $VISUAL has precedence but I don't think any system sets that
| one by default, whereas many do set EDITOR. I guess the one
| drawback to this comment in reply to yours is that the very
| bottom of that fallback tree is "emacs", but what vimmer
| doesn't already have EDITOR=$(command -v vi)? :-D
|
| The gory details:
| https://www.gnu.org/software/bash/manual/html_node/Miscellan...
| jgwil2 wrote:
| I love vi bindings but I've found that if you're using oh-my-
| zsh this will break a bunch of stuff like the command history.
| If anyone knows of a workaround for that I'd love to hear about
| it.
| AceJohnny2 wrote:
| How do people discover the `defaults` keys?
|
| I occasionally stumble upon such secret troves of knowledge, but
| I'd love to find out how these are discovered.
|
| Is there, like, a way to intercept all `defaults`/settings reads
| to discover what keys are checked?
| akerl_ wrote:
| I think what you're looking for is "defaults read"
| AceJohnny2 wrote:
| Unfortunately, that only seems to print those defaults that
| are _set_ , not all defaults that are possible.
|
| For example, the NSToolbarTitleViewRolloverDelay setting,
| while valid per the article, isn't listed in the output of
| `defaults read`
| js2 wrote:
| Per sibling comments, you run strings on binaries, find out
| informally from Apple engineers, or dig through settings in
| the System Preferences and then use `defaults` to look for
| changes in output.
| c0nsumer wrote:
| I suspect that they are asking about finding settings which
| get used, but aren't documented. Like, how to find hidden
| settings that programs will use.
| larusso wrote:
| In my experience with plist settings is that they are
| rarely sparse. But sure finding hidden settings is a tricky
| issue.
| larusso wrote:
| Defaults is a tool which can read and write system and other
| application settings. By default it works on the system
| settings. One can either pass a bundle id or a path to a plist
| file to read and write other settings.
|
| You can see a huge list of settings by typing ,,defaults read"
| veloxo wrote:
| For mapping UI preferences to corresponding plist keys,
| https://github.com/catilac/plistwatch will monitor and output
| real-time changes. May be easier than diffing snapshots of
| `defaults read`.
|
| This doesn't help with "secret" settings that aren't exposed
| through the UI, but can be handy for creating setup scripts.
| xwowsersx wrote:
| Same question. I also want to _read_ a value, but can 't seem
| to get it right. For example, I'd like to know what the current
| value of CGFontRenderingFontSmoothingDisabled
|
| is. I tried defaults read
| CGFontRenderingFontSmoothingDisabled
|
| but got: Domain
| CGFontRenderingFontSmoothingDisabled does not exist
| zffr wrote:
| Theoretically you could attach to a process with LLDB, and use
| objc swizzling to intercept calls to NSUserDefaults. However to
| do this, I think you would need to disable SIP. Even then i'm
| not sure this would work.
|
| In practice, people probably just read user defaults and try to
| reverse engineer what they do.
| citruscomputing wrote:
| Yes! It doesn't work 100% of the time, but what I've been doing
| for my setup script is:
|
| `defaults read > old` -> change setting in GUI -> `defaults
| read > new` -> `diff old new`
|
| If nothing is there, you're out of luck, most likely. (I think
| I've had luck using -currentHost or maybe sudo sometimes
| though...) If there is something, `less new` and search for the
| string, then find the path to the key. Do a test read with
| `defaults read <domain> <item>` to see if you got the path
| right.
|
| You can also copy plist files (cp -r /Library/Preferences, or
| wherever) and then diff those. A useful alias to convert to
| xml:
|
| alias plist='plutil -convert xml1 -o /dev/stdout'
| lilyball wrote:
| AIUI some of them are communicated informally by Apple
| engineers to individuals, some of them are found by using
| `strings` on the binary and looking at reasonable-seeming keys,
| any key that actually has a UI to set it is typically found
| just by setting it in the UI and seeing what changed, some of
| this stuff may have had UI's in the past that were removed
| while still leaving the defaults key, some of this stuff may
| just write the keys into the preferences files automatically
| and so you can find them just by looking at what's already
| there, etc.
|
| Skimming this list right now a lot of the stuff I'm seeing
| definitely has UI settings, so a lot of these are just useful
| for e.g. automating the setup of a new user.
| riffic wrote:
| folks should probably avoid linking their own personal git forge
| (or others, if this is the case) to HN and just use GitHub to
| share their code. or deploy the content to a static site host.
| aliqot wrote:
| Why even have any sites in other places? Why not just put
| everything on Github, then it's all in one place within reach
| at us-east-2
| riffic wrote:
| I'm thinking in terms of etiquette and experience. It's not
| really polite to throw a bunch of unexpected traffic at a
| little lowly app server
| autotune wrote:
| Agreed, even as a SRE myself it is just easier to link to a
| GitHib repo. GH, with all of its warts, is still likely better
| at handling a traffic spike than you.
| jgwil2 wrote:
| Link elsewhere in this thread[0] shows that this user removed
| this repo from GitHub deliberately, so I doubt they're the
| account who shared it.
|
| [0]: https://news.ycombinator.com/item?id=33897373
| AceJohnny2 wrote:
| People are free to host however they like. They can't control
| who posts links on popular aggregators.
| autotune wrote:
| https://archive.ph/PXzE7 since it's currently receiving the HN
| hug of death.
| js2 wrote:
| > There's really only one thing I'd like to note here: man pages.
| Man pages. Man pages. Okay, three things. But this one thing
| seemed so important, I had to mention it multiple times. If
| you're not doing it already, you should get into the habit of
| consulting man pages before searching anywhere else. Unix-style
| man pages are an excellent source of documentation. There's even
| a man page for the man command itself:
|
| YES YES YES. It's how I learned my way around Unix back in SunOS
| days. I literally started with "man intro" and worked my way out
| from there. Sun's documentation was _excellent_.
|
| Sadly, Linux and even BSD man pages are more hit or miss compared
| to Sun's documentation. But they are still a great place to
| start.
| xwowsersx wrote:
| I'm having a lot of trouble with getting fonts to look clear and
| unfuzzy on my M1 Pro with a new LG 38WN95C-W 38" 21:9 (3840 x
| 1600) monitor I just bought. It's driving me nuts. I've tried
| different picture settings on the monitor, with and without HDR,
| tried different resolutions, tried every possible value of
| `defaults -currentHost write -g AppleFontSmoothing -int ${n}` but
| no dice.
|
| Anyone have any ideas what I can do to resolve?
|
| Machine details below: Software:
| System Software Overview: System Version: macOS
| 12.6 (21G115) Kernel Version: Darwin 21.6.0
| Boot Volume: Macintosh HD Boot Mode: Normal
| Secure Virtual Memory: Enabled System Integrity
| Protection: Enabled Time since boot: 4:14
|
| Hardware: Hardware Overview:
| Model Name: MacBook Pro Model Identifier:
| MacBookPro18,1 Chip: Apple M1 Pro Total
| Number of Cores: 10 (8 performance and 2 efficiency)
| Memory: 32 GB System Firmware Version: 7459.141.1
| OS Loader Version: 7459.141.1
| mrpippy wrote:
| How is the monitor connected? USB-C/DisplayPort or HDMI?
| jedberg wrote:
| Are you sure you're running the monitor at its native
| resolution and not scaled? And do they provide a display
| profile that you can load?
|
| Edit: This post would indicate that it's a bug in the
| interaction between the Mac and the monitor and is not fixed:
| https://forums.macrumors.com/threads/fuzzy-text-with-lg-38wn...
| xwowsersx wrote:
| I am pretty sure I'm running it at the native resolution and
| not scaled, yes. At least, I'm _pretty_ sure:
| > system_profiler SPDisplaysDataType | grep Resolution
| Resolution: 3840 x 1600 (Ultra-wide 4K)
|
| And ah dang, thanks for the link. Someone there mentioned
| that getting a higher PPI monitor could help and might be the
| only way to get HiDPI modes. I did notice when I used
| switchResX for a bit that the HiDPI mode was greyed out and
| unavailable. Guess I'm going to have to return this monitor
| :(
| matthew-wegner wrote:
| BetterDisplay can get you supersampling on <4K monitors. I
| run a 4K monitor as my main display that did this out of
| the box with macOS, but I have side 1440p monitors that
| didn't. This fixed it:
| https://github.com/waydabber/BetterDisplay
| dharma1 wrote:
| Try this https://www.reddit.com/r/ultrawidemasterrace/comme
| nts/sve8jf...
| extr wrote:
| * Is the monitor running in RGB or YPbPr? With M1 Macs some
| monitors are getting forced into YPbPr mode and fonts look
| worse because of it. (https://gist.github.com/GetVladimir/c89a2
| 6df1806001543bef4c8...)
|
| * Remember to log out and log back in after you set font
| smoothing to 0. For me, this tweak helped a lot with clarity
| but I initially didn't think it was working because I didn't
| know you had to log out.
|
| * In general I've found Macs just suck at DPI scaling. If I'm
| not mistaken, your monitor is around 109 PPI, which isn't
| really that high compared to the internal screen (~250ppi), and
| firmly in the "non-Retina" UI elements zone. Check out these
| blog posts (https://bjango.com/articles/macexternaldisplays/,
| part 2: https://bjango.com/articles/macexternaldisplays2/) for
| more info on how this stuff works.
|
| Imagine my surprise when I found out my 27" 4K screens that
| look incredibly sharp on Windows at 163ppi are actually in the
| "bad zone" for Macs, and look bad at native resolution. As a
| workaround I run them scaled @ 3360 x 1890 and then set my
| browser to permanent 90% zoom level. Kind of embarrassing that
| Windows has completely lapped Apple in terms of good sharp UI
| at flexible scaling levels. I mean you can set Windows DPI
| scaling down the single % point, it's great.
| skydhash wrote:
| As someone who is dealing with this problem (27" 1440p
| monitor), I read that macOS renders the whole screen as a
| whole, instead of having a separate path for text. And there
| is a threshold PPI before it uses 2x assets. I had to use
| either a blurred rendering for bigger UI elements or the
| sharp, but small, representation at the native resolution.
| BetterDisplay[0] helped by tricking the OS to use the 2x
| assets at a smaller resolution. Still not as clear as my
| MBA's screen.
|
| [0]: https://github.com/waydabber/BetterDisplay
| xwowsersx wrote:
| Followed along with the video to Force RGB Color on M1 Mac,
| but seems I already had PixelEncoding set to 0 in
| com.apple.windowserver.displays.plist
| xwowsersx wrote:
| > Is the monitor running in RGB or YPbPr?
|
| I am not sure...? How can I find out? Thanks for that gist,
| I'll look into it after checking whether BetterDisplay
| resolves my issues as another commenter pointed me to.
|
| > Remember to log out and log back in after you set font
| smoothing to 0
|
| Hehe yeah. I have actually been operating under the
| assumption that I needed a full restart, which I have done
| several times :P (though this isn't so bad since the machine
| starts pretty dang quick).
|
| > In general I've found Macs just suck at DPI scaling
|
| I'm learning this :( It's very frustrating and disappointing.
| dpkirchner wrote:
| I don't know if I have the same display (it is also 21:9, in
| any case) but one issue I found is when I'm in some "gaming
| mode", I get ugly font rendering. It looks great if I switch to
| "user mode", but I don't know exactly what is different.
|
| This is all configured in the display's own settings, not in
| the OS.
| howinteresting wrote:
| Switch to Linux, which has actual subpixel AA, unlike macOS and
| increasingly Windows.
| miniBill wrote:
| I mainline NixOS, but sometimes switching to Linux is... just
| not an option unfortunately. It's sad tbh that macOS dropped
| subpixel AA
| matthew-wegner wrote:
| I replied in a child comment too, but to put this on the
| original. BetterDisplay can fix this:
| https://github.com/waydabber/BetterDisplay#fully-scalable-hi...
| xwowsersx wrote:
| I followed those steps in the link you provided and played
| around with other resolutions and configurations as well, but
| still no dice. Everything is so fuzzy, I'm beginning to get a
| headache :(
| xwowsersx wrote:
| Thanks so much. I'll give that a try. I tried switchResX and
| easyres without much luck. Giving this one a try soon
| user3939382 wrote:
| There was a time when you'd get a printed manual with your
| computer that taught you these things. Now we can't even get
| Apple to provide digital documentation for a lot of these hidden
| features in macOS. I prefer the old way.
| alin23 wrote:
| Users of my monitor control app (https://lunar.fyi/) feel
| overwhelmed with the information I provide on the website and
| in little help hints placed in the app near each setting.
|
| If an app has this effect, I can't even imagine what an OS
| manual would feel like in these days.
|
| I wish I could provide a proper manual but I can barely keep up
| with updating the app website with the rate of change in
| technologies. A major OS upgrade would need an army of writers
| to update manual on time.
|
| Not that I wouldn't love it. It would be tremendously useful to
| have a PDF where I can Cmd-F obscure tidbits which I often need
| in building MacOS apps.
|
| I just think it's impractical given the complexity of software
| in this age.
| SQueeeeeL wrote:
| I don't even think it's the complexity, necessarily. More of
| the fundamental instability of it all. Why exactly does Mac
| or Windows need to be releasing entirely new OSes every 2
| years, except to maintain a new product for the demands of a
| corporate behemoth to chirp around. People have PERL scripts
| from 40 years ago that still execute fine, but I doubt anyone
| has a PowerShell file from the early 2010s that maintains
| behavior.
| masukomi wrote:
| I can't comment on Windows, but with regards to apple, they
| really don't. Sure they strut around like they have but
| really, they've tweaked some user apps like Mail and
| Safari, and made bug fixes under the covers. Every now and
| then they do something like muck with background
| scheduling, but mostly... it's just bug fixes and new APIs
| that don't invalidate old ones.
|
| The only problem I've had is dylib files relentlessly
| moving forward in versions and old ones not being available
| anymore, but i don't _think_ that's really an apple
| problem. That and the M1 architecture transition has moved
| some folders around for reasons I don't understand.
|
| My ancient scripts still work just fine.
| airtonix wrote:
| microsoftdoes wrote:
| It's not impractical for Apple and Microsoft literally does
| it. I'm not saying MSDN is perfect, but it's a very expansive
| and thorough documentation of (almost) everything in Windows.
|
| The only difference is that people like to make excuses for
| Apple.
| blondin wrote:
| love Cascadia Code as terminal and coding font. author might want
| to take a look.
| xrayarx wrote:
| An exhausting list of mac os specific settings, that can only be
| changed from terminal. Quite the effort!
| mdaniel wrote:
| If you were similarly curious about the mention of "GitHub stars"
| in the text hosted on their own cgit, this appears to be the
| back-story: https://github.com/herrbischoff/awesome-macos-
| command-line
| tomduncalf wrote:
| I'd love a tweak to change the speed of the Spaces animation when
| you switch desktop, it's so frustrating slow that I just don't
| use it. I've searched a few times and not found anything but
| thought I'd mention it here in case anyone does know of one!
| black-adder wrote:
| If you tick "Reduce motion" in Accessiblity, it fades in an out
| instead of scrolling, a lot faster! I wish there was a way to
| disable transitions altogether like in earlier OSX versions...
| user3939382 wrote:
| TotalSpaces can do it, you can switch instantly.
| alin23 wrote:
| Yabai (https://github.com/koekeishiya/yabai) with SIP disabled
| is the only way to do that nowadays.
|
| I personally gave up on Spaces completely because of this. Now
| I just have everything on a single space, and move through apps
| instantly using my rcmd app (https://lowtechguys.com/rcmd)
| miniBill wrote:
| Ugh, preach. I haven't found anything, and I did search around
| 0x008 wrote:
| What I would really like to know is how to mute an application. I
| have sounds disabled for outlook notifications in System settings
| _and_ do not disturb on. Yet, I hear chimes /bells from outlook
| every time I receive an email.
|
| Anybody else experience similar things?
| dhagz wrote:
| For Outlook specifically, look in Outlook's settings under
| "Notifications and Sound".
| 0x008 wrote:
| Thanks, I will check it. But how can it override the system
| settings, that is an oversight I think...
| pulvinar wrote:
| Don't have Outlook, but the setting is supposedly in Outlook's
| Personal Settings>Notifications and Sounds>Sounds, uncheck all.
| anigbrowl wrote:
| _Furthermore, looking at almost 26k GitHub stars for this
| repository, if only about 14% of the people who this resource is
| useful for, sponsored me with a one time amount of a single Euro,
| I could order a new machine that probably lasted me another eight
| years. It 's not something I'd expect, nor think I should. It's
| entirely my issue._
|
| It's unseemly that people have to beg like this. I would be happy
| to pay a small annual Github subscription if it were distributed
| back to repo maintainers. Same thing with all the 'buy me a
| coffee' tags and now the 'buy me a slice of pizza' ones. Instead
| of funding useful bodies of work with meaningful micro-grants you
| have projects competing to provide people with better cups to
| rattle.
| ricardobeat wrote:
| This kind of knowledge has historically been shared for free.
| We are not entitled to it, as much as the author is not
| entitled to compensation.
|
| At the risk of being downvoted to oblivion, I'll say this:
| asking for donations is great, complaining that people are
| "leeching" your CC-licensed content, not so much. If you don't
| have the bandwidth to maintain a project, just stop. Humanity
| will be fine.
|
| This move to monetize everything is a huge step backwards (or
| forwards into the abyss...).
| eastbound wrote:
| It's mind-blowing that the 8th wonder of humanity, the open-
| source software in general, which runs the entire world,
| reached other planets and has even _taken off_ from them (the
| helicopter on Mars ran Linux), has been a giant cooperation
| and donated for free by its owners. It far outdid the
| previous wonders and yet, it's immaterial.
| anigbrowl wrote:
| _This move to monetize everything is a huge step backwards_
|
| The guy can't afford to replace his 10 year old laptop,
| meantime rents and profits are at an all-time high. Seems
| like there's a few segments missing in the virtuous circle.
| simonw wrote:
| That's pretty much what GitHub Sponsors is.
| car wrote:
| Except it's targeted to whomever I feel like sponsoring.
| Maybe an additional way could be distribution of a general
| sponsorship fund based on the number of stars or another
| measure of merit/popularity? I've sponsored individual
| projects on GitHub before, but would prefer this way.
| elashri wrote:
| If something like this is going to be based on number of
| stars, imagine how this will turn the current "give us a
| star on github" to.
| anigbrowl wrote:
| Yes, that's my point. It's another market, and while
| markets have a lot of utility they also tend towards
| bimodal distributions which disproportionately reward a
| very successful and visible participants while
| disproportionately exploiting a much larger group. A pure
| market system has higher entropy than one which features
| some redistribution.
|
| https://arxiv.org/pdf/cond-mat/0001432.pdf
| diegof79 wrote:
| Thanks for sharing this! The "Remove proxy icon hover delay"
| setting is the first thing I'll try. Many times I use the proxy
| icon in Preview to move a pdf file... the delay introduced in Big
| Sur is extremely annoying.
___________________________________________________________________
(page generated 2022-12-07 23:01 UTC)