11
votes
Accepted
Terminal calculator like concalc from Ubuntu
Your Mac comes preinstalled with bc;
bc -le "2*(3+4/9)^3"
bc <<< "2*(3+4/9)^3" -l
both produce
81.73113854595336076784
(thanks @Gilby for the more natural syntax)
The -...
- 3,864
4
votes
Terminal calculator like concalc from Ubuntu
In addition to Glorfindel’s answer (should be accepted), there is Calc (free) which is a C style arbitrary precision calculator. I’m just posting this as an excellent alternative to consider.
It’s ...
- 88.7k
4
votes
Anyway to obtain list of Application that can open a file via Terminal?
You can write it in Swift. Create a file called List.swift, use that code inside:
import CoreServices
import Foundation
let args = CommandLine.arguments
guard args.count > 1 else {
print("...
- 22.9k
4
votes
Terminal calculator like concalc from Ubuntu
This answer discusses a few possibilities that are bundled with macOS.
Shell built-in features
In this section, $ represents a bash prompt and % represents a zsh prompt.
For simple operations, if you ...
3
votes
Accepted
How to get version of `/usr/bin/time` command on macOS?
The time command included with macOS is open source. For macOS 13.2, the links start here. Follow the GitHub link for shell_cmds-278 to here, then the folder time to here and you will find the man ...
- 36k
3
votes
Terminal calculator like concalc from Ubuntu
You can compile concalc for macOS yourself.
Get Homebrew and use it to install cmake
Get the latest concalc source from Sourceforge (version 0.9.3 dated 2010-04-05)
tar xzf concalc-0.9.3.tar.gz to ...
- 92.6k
3
votes
Help with osascript Command to Hide Login Item on MacOS Ventura
it looks like your code is using smart quotes. This is an autocorrect "feature" in macOS. That would be interpreted as an unknown token if you're copy/pasting it with the smart quotes. If ...
- 31
3
votes
Deleting a binary from the bin folder that attempts to open at startup in Mac Ventura 13.2.1
There is a binary named 'Open' that resides in my usr/bin folder that I cannot delete.
You cannot and should not delete this file!
It’s a macOS utility that allows you to open files and folders with ...
- 88.7k
2
votes
Accepted
Xcode Command Line Tools not installing, missing xcrun
Updating to Xcode 14.2 the other day seems to have fixed it.
xcrun did give the error "SDK/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk" ...
- 21
2
votes
Query whether MacBook is plugged or on battery from shell script
You can leverage the pmset (power management settings) tool from a shell script to ascertain if you are running on battery or AC power. See the manual pages (man pmset) for more details.
For example, ...
- 760
2
votes
What is the difference between the -d and -i flags in the caffeinate command?
I would assume that 'display sleeping' means that the display goes black but the system is still running. e.g. checking for mail & running apps continue to run.
'system idle sleep' sounds like ...
- 768
2
votes
Accepted
Equivalent to systemd timers on OS X?
On Linux, many distros ship with systemd. Systemd supports "timers", which are a kind of systemd service for running programs on a schedule... Is there a similar way of scheduling tasks in ...
- 88.7k
1
vote
GRAP pre-processor doesn't seem available for groff on macOS Monterey?
At least on Ventura, groff isn't part of macOS any longer.
To install groff and grap, use Homebrew and run brew install groff grap.
- 92.6k
1
vote
How to get version of `/usr/bin/time` command on macOS?
If you ask which time you get time: shell reserved word. It is documented in the man page for your shell e.g.
% man zshmisc
...
time [ pipeline ]
The pipeline is executed, and timing ...
- 1,551
1
vote
MacOS Command Line for Track Pad Settings
I'm setting up a new Mac with Ventura and have read of large inconsistencies in older system pref cmds, and unintended results in setting them via CLI (even when they do still exist). Due to Apple not ...
- 461
1
vote
MacOS Command Line for Track Pad Settings
One method of determining what preference keys are is to make the change in the GUI, and then sort ~/Library/Preferences by Date Modified. You can then see which files have been modified by changing ...
- 28.9k
1
vote
Accepted
Shell script to reboot from different volume
I used the command suggested in comments and it worked.
sudo bless -mount /Volumes/Boot_Volume -setBoot
From there I can create a Bash/Zsh script, function or alias that I can call that will set my ...
- 141
1
vote
Help with osascript Command to Hide Login Item on MacOS Ventura
This works for me.
/usr/bin/osascript -e 'tell application "System Events" to make new login item at end with properties {name:"WebDrive.app", path:"/Applications/WebDrive.app&...
- 6,887
1
vote
How to go to a specific line in nano on macOS?
Ctrl+/ works on GNU nano 7.2 :
GNU nano, version 7.2
(C) 2023 the Free Software Foundation and various contributors
Compiled options: --disable-libmagic --enable-utf8
- 259
1
vote
Accepted
Run a command without opening the terminal
My solution: I created shell scripts for my commands instead of aliases, and included the folder in the PATH variable. Thereby I could call them from any bash shell on the system. Then I used the ...
- 81
1
vote
Get purgeable space with diskutil CLI
how can I get purgeable space as shown in Disk Utility's GUI 30.41 GB (2.05 GB purgeable) from diskutil CLI ?
Unfortunately, this is not possible.
The purgeable space reported by the (GUI) Disk ...
- 88.7k
1
vote
zip: cannot use the -FF flag and -q flag at the same time
Using -FF together with -q seems to destroy the zip file.
$ ll
total 8
-rw-r--r-- 1 pse staff 1151 Feb 12 16:26 foo.txt
$ zip foo foo.txt
adding: foo.txt (deflated 44%)
$ zip -q -FF foo.zip --out ...
- 92.6k
1
vote
How to fix borked Xcode Commandline Tools?
Here's what's worked for me. It's unclear what steps are optional or not, since I've tried so many combinations:
Reset Xcode command line tools: sudo xcode-select --reset, then sudo rm -rf /Library/...
- 111
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
command-line × 2902macos × 1411
terminal × 1063
bash × 425
applescript × 181
homebrew × 157
script × 143
zsh × 122
unix × 118
xcode × 98
finder × 91
automator × 89
network × 80
mac × 75
catalina × 71
permission × 64
iterm × 56
filesystem × 55
keyboard × 54
path × 53
install × 47
open-source × 47
mojave × 46
launchd × 46
macbook-pro × 45