Version 1 vs 2
Version 1 vs 2
Edits
Edits
- Edit by keithzg, Version 2
- Apr 30 2022 4:45 PM
- Move Here by keithzg, Version 1
- Jul 5 2021 9:32 PM
- ·Moved to beneath the new path as I commit to writing some documentation on macOS stuff (largely so I don't forget as I figure things out)
Original Change | Most Recent Change |
Edit Current Version 1... | Edit Draft Version 2... |
Content Changes
Content Changes
So, you're trying to use the Terminal app on macOS, eh? Maybe you're unfamiliar with the terminal, with macOS, or both? Well, here are some pointers for you, imaginary person and/or Sam!
= Neat basics =
----
== {key tab} ==
Use the tab key all the time! Type as little as you actually have to, let tab autocomplete do all the heavy lifting!
----
== `cd` ==
Now of course, everyone and their dog knows you use the `cd` command to change directories. But did you know that if you just run `cd` without any arguments, it returns you to your home directory? Ah, exquisitely lazy! Particularly useful on macOS, since the Terminal generally //doesn't// actually start you in your home directory.
----
== `pushd` and `popd` ==
While most of the time one changes directories using `cd`, if you're going off to some other directory for a bit but planning on returning to where you currently are, `pushd` and `popd` can be quite useful. They're a classic [[ https://en.wikipedia.org/wiki/Stack_(abstract_data_type) | stack ]], so for instance rather than
```
totally-real-mac:/some/place user$ cd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ cd /some/place
totally-real-mac:/some/place user$
```
just run
```
totally-real-mac:/some/place user$ pushd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ popd
totally-real-mac:/some/place user$
```
Obviously this isn't always that much more helpful than just using `cd`, but in some circumstances it can be quite nice!
----
== {key alt .} ==
In a normal Linux terminal, {key alt .} calls back up the last portion of the last command you typed. So for instance, if you just ran `touch somefile`, then typing `chmod +x ` and then press {key alt .}, viola, now you have `chmod +x somefile`! And you can tap {key .} multiple times to walk back through your history. This is really quite handy a lot of the time.
Unfortunately on macOS this instead just prints a ≤ character. I hate you //so much//, Apple.
There are two ways around this:
1. {nav Terminal > Preferences > Profiles} and checkmark "Use Option as Meta key". That fixes it entirely.
2. Use {key Escape .} instead. Unfortunately, this is not only more awkward but it's made even more awkward by requiring you to press `Esc` each time too, rather than just {key .} like with {key alt .}, so you should really just use option 1.
----
= Okay, now what? =
== Install MacPorts ==
The Ruby brogrammers love [[ https://brew.sh/ | Homebrew ]], but frankly [[ https://www.macports.org/ | MacPorts ]] is probably better (as you might expect, when the other option is beloved by people who also love Ruby).
== Play ambient noise that sounds like you're on the Enterprise D! ==
1. Download [[ http://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2-macosx.zip/download | the zip of the Mac version of SoX ]], or use MacPorts.
2. Just run the following command:
## For a downloaded and unzipped version: `./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | ./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
## Via MacPorts: `play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
== Use KDE Craft ==
Rather than MacPorts, you can directly bootstrap up and compile KDE applications. See:
* [[ https://community.kde.org/Craft | Craft ]]
** [[https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Mac#Installation_using_Craft | Craft on Mac ]]
** [[ https://kde.inoki.cc/2019/05/19/Craft-vlc/ | VLC on Craft on Mac]]
== So what shell are you using? ==
Apple traditionally used Bash, with an emphasis on traditionally; their hatred of the [[ https://www.gnu.org/licenses/quick-guide-gplv3.en.html | GPLv3 ]] meant being stuck at a very old version. Recently [[ https://support.apple.com/en-ca/HT208050 | they've decided to switch to Zsh ]]. You could too, dear reader; or you could install a fresh version of Bash, or some other shell entirely.
So, you're trying to use the Terminal app on macOS, eh? Maybe you're unfamiliar with the terminal, with macOS, or both? Well, here are some pointers for you, imaginary person and/or Sam!
= Neat basics =
----
== {key tab} ==
Use the tab key all the time! Type as little as you actually have to, let tab autocomplete do all the heavy lifting!
----
== `cd` ==
Now of course, everyone and their dog knows you use the `cd` command to change directories. But did you know that if you just run `cd` without any arguments, it returns you to your home directory? Ah, exquisitely lazy! Particularly useful on macOS, since the Terminal generally //doesn't// actually start you in your home directory.
----
== `pushd` and `popd` ==
While most of the time one changes directories using `cd`, if you're going off to some other directory for a bit but planning on returning to where you currently are, `pushd` and `popd` can be quite useful. They're a classic [[ https://en.wikipedia.org/wiki/Stack_(abstract_data_type) | stack ]], so for instance rather than
```
totally-real-mac:/some/place user$ cd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ cd /some/place
totally-real-mac:/some/place user$
```
just run
```
totally-real-mac:/some/place user$ pushd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ popd
totally-real-mac:/some/place user$
```
Obviously this isn't always that much more helpful than just using `cd`, but in some circumstances it can be quite nice!
----
== {key alt .} ==
In a normal Linux terminal, {key alt .} calls back up the last portion of the last command you typed. So for instance, if you just ran `touch somefile`, then typing `chmod +x ` and then press {key alt .}, viola, now you have `chmod +x somefile`! And you can tap {key .} multiple times to walk back through your history. This is really quite handy a lot of the time.
Unfortunately on macOS this instead just prints a ≤ character. I hate you //so much//, Apple.
There are two ways around this:
1. {nav Terminal > Preferences > Profiles} and checkmark "Use Option as Meta key". That fixes it entirely.
2. Use {key Escape .} instead. Unfortunately, this is not only more awkward but it's made even more awkward by requiring you to press `Esc` each time too, rather than just {key .} like with {key alt .}, so you should really just use option 1.
== {key Home} and {key End} ==
By default, Home and End are entirely broken in the macOS terminal from the perspective of ; rather than moving the cursor to the start or end of a line being typed, they move the terminal scrolling to the top or bottom. [[ https://apple.stackexchange.com/a/114528 | people online will claim ]] that {key shift home} / {key shift end} will act normally but they appear to do nothing in Terminal.app version 2.12.5 (444) on the latest OS release as of this writing (12.3.1).
There are several ways to fix this. For one, you can try and [[ https://www.reddit.com/r/MacOS/comments/pz9vnu/comment/hf0f0nk/?utm_source=share&utm_medium=web2x&context=3 | fix this universally in macOS]] with [[ https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html | the KeyBindings.dict file]], ex:
```
name=~/Library/KeyBindings/DefaultKeyBinding.dict
{
"\UF729" = "moveToBeginningOfLine:";
"\UF72B" = "moveToEndOfLine:";
}
```
----
= Okay, now what? =
== Install MacPorts ==
The Ruby brogrammers love [[ https://brew.sh/ | Homebrew ]], but frankly [[ https://www.macports.org/ | MacPorts ]] is probably better (as you might expect, when the other option is beloved by people who also love Ruby).
== Play ambient noise that sounds like you're on the Enterprise D! ==
1. Download [[ http://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2-macosx.zip/download | the zip of the Mac version of SoX ]], or use MacPorts.
2. Just run the following command:
## For a downloaded and unzipped version: `./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | ./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
## Via MacPorts: `play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
== Use KDE Craft ==
Rather than MacPorts, you can directly bootstrap up and compile KDE applications. See:
* [[ https://community.kde.org/Craft | Craft ]]
** [[https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Mac#Installation_using_Craft | Craft on Mac ]]
** [[ https://kde.inoki.cc/2019/05/19/Craft-vlc/ | VLC on Craft on Mac]]
== So what shell are you using? ==
Apple traditionally used Bash, with an emphasis on traditionally; their hatred of the [[ https://www.gnu.org/licenses/quick-guide-gplv3.en.html | GPLv3 ]] meant being stuck at a very old version. Recently [[ https://support.apple.com/en-ca/HT208050 | they've decided to switch to Zsh ]]. You could too, dear reader; or you could install a fresh version of Bash, or some other shell entirely.
So, you're trying to use the Terminal app on macOS, eh? Maybe you're unfamiliar with the terminal, with macOS, or both? Well, here are some pointers for you, imaginary person and/or Sam!
= Neat basics =
----
== {key tab} ==
Use the tab key all the time! Type as little as you actually have to, let tab autocomplete do all the heavy lifting!
----
== `cd` ==
Now of course, everyone and their dog knows you use the `cd` command to change directories. But did you know that if you just run `cd` without any arguments, it returns you to your home directory? Ah, exquisitely lazy! Particularly useful on macOS, since the Terminal generally //doesn't// actually start you in your home directory.
----
== `pushd` and `popd` ==
While most of the time one changes directories using `cd`, if you're going off to some other directory for a bit but planning on returning to where you currently are, `pushd` and `popd` can be quite useful. They're a classic [[ https://en.wikipedia.org/wiki/Stack_(abstract_data_type) | stack ]], so for instance rather than
```
totally-real-mac:/some/place user$ cd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ cd /some/place
totally-real-mac:/some/place user$
```
just run
```
totally-real-mac:/some/place user$ pushd /some/otherplace
totally-real-mac:/some/otherplace user$ {do a buncha crap}
totally-real-mac:/some/otherplace user$ popd
totally-real-mac:/some/place user$
```
Obviously this isn't always that much more helpful than just using `cd`, but in some circumstances it can be quite nice!
----
== {key alt .} ==
In a normal Linux terminal, {key alt .} calls back up the last portion of the last command you typed. So for instance, if you just ran `touch somefile`, then typing `chmod +x ` and then press {key alt .}, viola, now you have `chmod +x somefile`! And you can tap {key .} multiple times to walk back through your history. This is really quite handy a lot of the time.
Unfortunately on macOS this instead just prints a ≤ character. I hate you //so much//, Apple.
There are two ways around this:
1. {nav Terminal > Preferences > Profiles} and checkmark "Use Option as Meta key". That fixes it entirely.
2. Use {key Escape .} instead. Unfortunately, this is not only more awkward but it's made even more awkward by requiring you to press `Esc` each time too, rather than just {key .} like with {key alt .}, so you should really just use option 1.
== {key Home} and {key End} ==
By default, Home and End are entirely broken in the macOS terminal from the perspective of ; rather than moving the cursor to the start or end of a line being typed, they move the terminal scrolling to the top or bottom. [[ https://apple.stackexchange.com/a/114528 | people online will claim ]] that {key shift home} / {key shift end} will act normally but they appear to do nothing in Terminal.app version 2.12.5 (444) on the latest OS release as of this writing (12.3.1).
There are several ways to fix this. For one, you can try and [[ https://www.reddit.com/r/MacOS/comments/pz9vnu/comment/hf0f0nk/?utm_source=share&utm_medium=web2x&context=3 | fix this universally in macOS]] with [[ https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html | the KeyBindings.dict file]], ex:
```
name=~/Library/KeyBindings/DefaultKeyBinding.dict
{
"\UF729" = "moveToBeginningOfLine:";
"\UF72B" = "moveToEndOfLine:";
}
```
----
= Okay, now what? =
== Install MacPorts ==
The Ruby brogrammers love [[ https://brew.sh/ | Homebrew ]], but frankly [[ https://www.macports.org/ | MacPorts ]] is probably better (as you might expect, when the other option is beloved by people who also love Ruby).
== Play ambient noise that sounds like you're on the Enterprise D! ==
1. Download [[ http://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2-macosx.zip/download | the zip of the Mac version of SoX ]], or use MacPorts.
2. Just run the following command:
## For a downloaded and unzipped version: `./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | ./Downloads/sox-14.4.2/play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
## Via MacPorts: `play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +10 | play -n -c2 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1`
== Use KDE Craft ==
Rather than MacPorts, you can directly bootstrap up and compile KDE applications. See:
* [[ https://community.kde.org/Craft | Craft ]]
** [[https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Mac#Installation_using_Craft | Craft on Mac ]]
** [[ https://kde.inoki.cc/2019/05/19/Craft-vlc/ | VLC on Craft on Mac]]
== So what shell are you using? ==
Apple traditionally used Bash, with an emphasis on traditionally; their hatred of the [[ https://www.gnu.org/licenses/quick-guide-gplv3.en.html | GPLv3 ]] meant being stuck at a very old version. Recently [[ https://support.apple.com/en-ca/HT208050 | they've decided to switch to Zsh ]]. You could too, dear reader; or you could install a fresh version of Bash, or some other shell entirely.