Questions tagged [command-line]
Using programs and commands that do not have a graphical user interface (GUI) but are rather controlled by typing text commands into a terminal program, or shell.
3,185
questions
5
votes
3
answers
2k
views
Convert PS file to PDF using macOS Ventura?
I have created a .ps file using this command:
man -t man > test.ps
But what I want to do is convert the .ps file to a .pdf file.
If someone could point me in the right direction I would appreciate ...
1
vote
0
answers
178
views
tmutil compare does not list changes between Time Machine backups
I can't get tmutil compare to give me a full list of changes between two Time Machine backups.
When I run
tmutil compare > ~Desktop/Changes_since_last_backup.txt
I get a full list of changes ...
1
vote
0
answers
2k
views
Toggle Network Filters
What terminal commands list/toggle Status for network Filters & Proxies?
Background: Cisco Secure Client (VPN) has added three network filters:
Disconnecting and closing Cisco Secure Client does ...
8
votes
3
answers
970
views
What does a question mark `?` in the STAT column of `ps` on MacOS indicate?
When running the command
ps -xo pid,stat,user,time
On MacOS (Monterey; version 12.5), I sometimes get a ? in the STAT column:
PID STAT USER TIME
[...] Removed for brevity
72633 S mbercx ...
3
votes
2
answers
390
views
What are the directories I see when I hit tab on `cd ~` that are not seen in `ls ~`
When I hit tab on cd ~, I see a lost of directories starting with _ so something like _dirName which are not see when I list ls ~. I also see myUsername, root, daemon, nobody, Guest directories. What ...
1
vote
2
answers
865
views
gpt operation not permitted in Ventura
Trying to run the gpt command with anything other than show returns an 'operation not permitted' error, regardless of using sudo, running in a root shell, making sure disk is unmounted, and even ...
0
votes
0
answers
350
views
Internet Recovery Mode's Terminal cannot run Disk Drill
Disk Drill has an official tutorial on how to run it directly from the Terminal on Internet Recovery Mode.
Basically, use sh <(curl http://www.cleverfiles.com/bootmode/boot.xml) for Disk Drill 5, ...
1
vote
2
answers
415
views
When looking at man page, some characters produced by `man` are not rendered
When I do in my terminal a, for instance,
man tr
I can see that some of the texts are rendered in different colours, based on the control characters which man produces in its output, while some are ...
1
vote
0
answers
47
views
Open Finder in list view from command line
I know that I can open Finder for a certain directory from the command line by using
open DIRECTORYPATH
This shows the directory in the default view, which is fine most of the time. However I ...
0
votes
1
answer
221
views
Is there a cli command to dump the ACL associated to a file (in a MacOS context)?
I would like to know if it is possible, and if it is, how can be seen the ACL (Access Control List) associated to a file in a MacOS context, using command line (not using the GUI "File ...
0
votes
0
answers
523
views
Using Powerlevel9k with oh-my-zsh showing powerlevel9k icons but showing weird character '?' for zsh icons on my Mc Book terminal
I've been using powerlevel9k with zsh since many years now on my Mac Book. But since few days that I bought a new Mac Book Pro Ventura 13.3.1, and reinstalled powerlevel9k and oh-my-zsh the same way I ...
2
votes
1
answer
77
views
In the Download folder, What ~$ mean?
In the Download folder, when I do ls, I can find this
El lobo solitario y su cachorro (Kazuo Koike y Goseki Kojima) - Tomo 01.cbr ~$OL 68412 Advanced Clinical Bioinformatics 2022 Timetable.docx
~$...
2
votes
1
answer
94
views
convert or parse float to int in bash script fails in several ways
We have:
MINUTES_UNTIL_ASK_TO_CLOSE="0,2"
number_of_iterations=$((MINUTES_UNTIL_ASK_TO_CLOSE * 60 / 5))
There are a couple of weird behaviors when doing that.
Firstly, the result should be:
...
0
votes
1
answer
22
views
Gihub on Mac using oath2
After a pause of 2 years from macOS I bought a new laptop to find this problem:
I cannot pull/push to my repositories using a user/password. The new approach is through oath2. At this point, I am able ...
0
votes
0
answers
37
views
How to copy files from a Mac in "Disk Sharing" mode to another Mac? [duplicate]
I have a borked Macbook Pro running apple silicon, and to recover files from it I've shared Macintosh HD in "Shared Disk" mode via startup options and connected it to a working mac with a ...
0
votes
1
answer
1k
views
`sudo` and other commands not found in terminal in startup options mode
(EDITED for specificity)
When I use terminal in recovery mode (on a MacBook Pro with Apple silicon) a lot of bash commands seem to be missing and give me "command not found" errors when I ...
5
votes
2
answers
511
views
man command, and output decoration (bold/underline/...)
When I do, say, a
man zsh
I get the zsh man page, parts of the text are in bold or underline, which makes it for easier reading. man is doing this for instance by inserting 0x08 control codes in its ...
3
votes
1
answer
2k
views
What does Cmd + K do in the Terminal?
I am a rookie at using Terminal, and I am acquainting myself with it by simultaneously learning Git on it. Still new to the shortcuts therein, I accidentally pressed Cmd+K, and the whole screen went ...
2
votes
1
answer
262
views
Trying to access our FTP server. Getting "Killed 9." How do I resolve this?
I just tried to access our FTP server via the command-line FTP client on my new M2 Mini.
And it gives an immediate "Killed 9" message.
On my 2017 iMac (Catalina):
(Note that the ftp server ...
0
votes
2
answers
133
views
How do I view *.info document files on macOS?
Is there a Homebrew package (or other source) that installs a macOS (Ventura 13.3.1) version of info?
1
vote
0
answers
17
views
How to run a cron job using launchd? [duplicate]
I have a simple cron job:
MAILTO=“”
0 9 * * * /path/to/job
My issue with this job being that it won’t run if my Mac isn’t up and running (sleep mode). I read launchd/launchctl may be what I’m looking ...
1
vote
0
answers
47
views
How to send simple one line emails on macOS from command line to/from gmail? [duplicate]
My need is simple, I want something with this functionality:
echo 'hello' | mail -s 'test' [email protected]
The above currently works and mail is able to send to an icloud email and sends via some ...
5
votes
1
answer
556
views
Open two files for comparison in FileMerge, from command line
I have two files (in a project’s source code base) which I often want to compare visually in FileMerge, as part of a regular routine. I’m trying to script that routine for efficiency, but am stuck on ...
0
votes
3
answers
470
views
How do I get the key for a specific letter for hidutil?
I want to get a backtick ` when I type i (Option ⌥+' on my Italian keyboard), and do the same with ¶ and ~.
I landed upon this solution which looks great, but I can't find the reference to the correct ...
0
votes
0
answers
77
views
Prevent double clicked SH script from being entered into ZSH history on Mac
I've got some SH scripts which I double click to run. The scripts run as intended, after having set the working directory via cd "$(dirname "$0")" at the beginning of the script, ...
0
votes
1
answer
240
views
Help with sh files on Mac
I am analyzing a data set and preparing it for preprocessing and I am back into computer science after some time so bear with me ( I am a Mac user)
I am trying to run this sh file that will not run ...
1
vote
2
answers
332
views
Open .webloc file with colons in its name using "open"
Suppose I have a file ~/Desktop/foo:bar.webloc.
(a) If I double-click it, it opens a particular web page. Great!
(b) If in the Terminal I run open ~/Desktop/foo:bar.webloc, it opens the webpage. Great!...
1
vote
1
answer
3k
views
zsh: bad CPU type in executable (on Intel, not M1)
I have the reverse case of the other question with the same name (zsh: bad CPU type in executable).
I used the mac moving assistant to go from an M1 to an Intel, and the PHP that is used in my ...
0
votes
0
answers
238
views
How to create a system user/group that will appear in /etc/passwd and /etc/groups?
I want to programmatically create a system user (and group) for a new system service I'm working on. I've followed the hints to use dscl here:
https://serverfault.com/questions/20702/how-do-i-create-...
1
vote
1
answer
223
views
ps return pid/name of process that called script.sh
I am running an app that calls script.sh and I would like to retrieve the invoking app's PID or name within that same script.sh. Ultimately, in my script.sh, I am trying to determine whether the app ...
1
vote
2
answers
258
views
How can I auto-mount a Network drive (Parallels OneDrive) in a bash script?
I have Parallels installed on an M1 Mac. In Parallels, I have a Windows 11 Pro VM. Parallels is configured to share Windows files with MacOS.
This is done via the Network tab in the Finder.
So, to ...
2
votes
1
answer
137
views
How can I fix Hyper.is (a third-party terminal program) when it freezes on idle too quickly for my needs?
The terminal in question is: https://hyper.is
MacOS 11.7.1 Big Sur is the operating system on a Macbook (2015). To troubleshoot this, I tried and reproduced the hang with Apple's native Terminal.app ...
0
votes
1
answer
79
views
Using sed to replace line results in two lines for each one replaced
I have been trying to automate something, using sed in a loop I wanted to do this:
while IFS= read -r line; do
sed -r -i '' "\"s|::set-output name=(.*)::(.*)\"|\"\1=\2\" >...
3
votes
2
answers
377
views
Which logs and command line tools for finding processes that hog the macOS CPU?
As you can see, I have frequent CPU hogs:
I inspected my mac with several security tools from https://objective-see.org/tools.html, if any viruses or shady processes are being started up or running ...
0
votes
2
answers
115
views
Does anyone else have lots of duplicate man pages?
For example, for the read man page, I have a single one for read(2), two of the same for read(1) and two of the same for read(n). This has led to some performance and timing issues. I believe it has ...
3
votes
2
answers
2k
views
Why didn't reverse grep work to filter out "Operation not permitted" from find results?
When I want to reverse grep the words in macOS 13.2 like this:
$ sudo find / -name "libpq.dylib" | grep -v "Operation not permitted"
find: /Library/Application Support/com.apple....
0
votes
1
answer
361
views
what is the file path to the photos app via terminal
I had a quick question regarding the file path of photos app. I am trying to run a bash/AppleScript script that accesses my photos app via terminal and uses the ls command to print all the file names ...
0
votes
1
answer
62
views
Simple method to mount a named drive from the command line?
To unmount a named drive from the command line I wrote a bash function which just tells the Finder via AppleScript to eject the drive:
eject () { osascript -e "tell application \"Finder\&...
7
votes
1
answer
727
views
Executable compiled in Xcode fails to run except from the terminal
I'm in the process of developing a game written in C using SDL, and while I do all of my development on Windows/Linux machines would like to make it available on Mac as well. The code is fully ...
0
votes
2
answers
132
views
Reveal multiple selected files in Finder from script
From within a shell script (or, similarly, within a terminal) I want to reveal multiple files in Finder with all named files already selected.
Surprisingly, using open -R with multiple arguments fails ...
0
votes
1
answer
163
views
How can I get `say` to use a different language for the same voice?
In the voice list output by say -v ?, some names can speak multiple languages. (The answers on this question only deal with single-language voices.) A subset of what I see includes:
Sandy (German (...
1
vote
1
answer
737
views
Problem with ARM package selection when installing homebrew git on an Intel MacBook Air
I was trying to install homebrew git but I got this
Error: Cannot install on Intel processor in ARM default prefix (/opt/homebrew)!
I have an Intel processor MacBook Air (13-inch, Early 2015) running ...
1
vote
1
answer
4k
views
How can I fix a zshrc:export:1: not valid in this context error when I'm installing homebrew?
I am getting this error when I start up Terminal on my Mac: .zshrc:export:1: not valid in this context
I got this error when installing Homebrew. Can anyone help with this?
I am a beginner for this; ...
1
vote
0
answers
258
views
How to get easy access to iCloud in zsh? [duplicate]
I have a new MacBook and did the following in Zsh:
% cd
% mkdir Cloud
% cd Cloud
% ln -s /Users/jdoe/Library/Mobile\ Documents/com~apple~CloudDocs iCloud
I was cautioned "Do not create ...
0
votes
0
answers
26
views
Unable to script the "add a dock space" function due to conflicts with running as root
I am a Jamf admin and need to make the "add a dock space" command line function into an easy to click button for our users. Many of them would be hesitant or not technically savvy enough to ...
5
votes
4
answers
2k
views
How to get the number of users on a Mac
I want to know how many local users there are. How can this be done from a command line?
Note: I am not looking for a list of the users, I can do that easily enough.
1
vote
2
answers
1k
views
How can I extract multipart tar files from the command-line on macOS?
I have multiple 2 GiB gzipped-tar files (.tgz) I downloaded from an online service with Safari. It's a Google Takeout of my entire photos library.
As each file downloaded, Safari automatically ...
0
votes
1
answer
286
views
Backup using `rsync` fails because of a file that is not even into the source directory to be backed up
I am trying to backup the /User/user01/Library using rsync (via the linux-timemachine wrapper https://github.com/cytopia/linux-timemachine) to an external hard drive Volumes/name_of_backup logged in ...
0
votes
1
answer
79
views
Acrobat Pro DC opens in the background when launching from the CLI
When I launch Acrobat from iTerm2 / Bash, Acrobat runs and loads the file, but it doesn't load on top of other applications like I would expect. I have to Cmd+Shift+Tab (to select the last ...
2
votes
1
answer
711
views
Command-line to use Remove Background action of MacOS Ventura
I want to use the quick action: Remove Background, which is available in the Finder of MacOS Ventura (right click -> quick actions -> Remove Background)
Does someone know how to do it with a ...