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.

Filter by
Sorted by
Tagged with
6
votes
2answers
157 views

extract the top-level domain and the second-level domain from a URL

I'd like to extra the top-level domain and the second-level domain from a URL like "https://apple.stackexchange.com/questions/ask" Example URL with desired result below. https://apple.stackexchange....
0
votes
0answers
9 views

clang: error: unsupported option '-fopenmp'. Change default compiler? [migrated]

I am on a Mac (Mojave) but I am not a Mac user. I am doing this mostly blindly, since I do not have the basis of make commands, compilers, xcode, and so on. I need to run a make command (actually ...
1
vote
0answers
12 views

How to control iPhone “Personal Hotspot” via Terminal

I'm a recent convert to Alfred and want to build workflows to connect and disconnect my MacBook to my iPhone's Personal Hotspot. Are these commands easily available in Terminal please? I've looked ...
1
vote
0answers
28 views

How do I set the terminal tab title via command line?

I want to set the terminal tab name from the command line. I am using this command to update the name echo -en "\033]0; New Name \007". Here is what my terminal now looks like. When I use the ...
1
vote
0answers
44 views

How to create Mac executable file like Dmg using Bash script [closed]

Jdk ,ICNS ,Jar etc keep in same folder but how to create executable file for mac please let me know using bash file(.sh) Need to create a file I can double-click and run instead of typing in the path ...
1
vote
1answer
32 views

Can I suppress the Setup Assistant When Creating New Users on macOS?

I wanted to create a new user using Terminal and managed to do so by finding answers on StackExchange, but I was not able to figure out how to skip the setup assistant that comes up when you login to ...
0
votes
0answers
28 views

Can a Terminal Mark be added via a shell command?

MacOS' Terminal's marks are an incredible feature. They allow you to add a "marker" to a line, which can be jumped between. Documentation about these commands is available in Apple's own documentation,...
10
votes
2answers
776 views

How to md5 a list of filepaths contained in a file?

I have a folder containing many folders containing many files. Thousands. I can do find . -type f > ./FILE-LISTING.TXT to create a file containing many thousands of file paths that looks like this:...
1
vote
2answers
68 views

Force eject a device

Because my drive will freeze occasionally, I would have to pull the cable out. (see the question below for more detail): Seagate Backup Plus 5 TB became unresponsive after long period of use I've ...
2
votes
0answers
49 views

How to check if any audio is currently playing via Terminal?

Sometimes I turn up the audio on my MacBook, but then forget to turn it back down. Is there a terminal command I could use to detect if audio is currently playing (sound coming from the speakers)? I ...
0
votes
2answers
75 views

Why so many shell in /bin

Here is the ls output of my /bin directory: [csh ksh zsh bash dash tcsh sh ...] Prior to catalina bash was the default and now zsh is default. What's the usage ...
0
votes
1answer
41 views

Command “istats” gives “-bash: istats: command not found” after “gem install iStats”

I wanted to use iStats in command line/terminal mode, so I did the following: I installed iStats with the command gem install iStats as per this answer to an AskDifferent question; However, when I ...
2
votes
1answer
49 views

Is it possible to query the current user's Apple ID from the command line?

Is it possible to query the current user's Apple ID from the command line? I want to create an AppleScript (run-only) app that will run only for a specific user (or at least for a user signed in with ...
3
votes
1answer
58 views

macOS: List apps authorized for full disk access

Is there a Terminal command to view a list of all macOS that are authorized and unauthorized but have asked for Full Access? I am looking for the list that is displayed under System Preferences → ...
-1
votes
1answer
55 views

How to script file for a Mac with several Terminal commands

I have few Terminal commands which i'm using so frequently,So i though to automate it to reduce the effort of copy-pasting the commands one by one in terminal and time. I created a .command file for ...
0
votes
0answers
25 views

iMac: How to disable display via terminal. Kernel_task issue CPU 70%

I have a Late 2015 iMac running macOS Mojave. I am looking to disable the main display and use an external display as the primary/default display. I am looking for a command-line that can do that. I ...
3
votes
0answers
54 views

How can I detect which button was clicked in the DMG EULA confirmation screen

I'm using the open command to automate (via bash) opening a dmg which has a EULA attached to it. When I run open my_app_distribution.dmg I get a screen that looks like this: The open commands uses ...
1
vote
1answer
104 views

cp command: Overwrite confirmation with file diff

When running cp command to copy files, I would like to be prompted for overwrite confirmation, and, if possible, view the file diff confirming. Is this possible? And if yes, how? Ideal example: $ ...
0
votes
1answer
76 views

What modifies the PATH variable on macOS? [duplicate]

echo $PATH returns a different result than the PATH variable I define in .bashrc. .profile is empty. What else could be modifying the PATHvariable? The directories listed are all things I would have ...
3
votes
1answer
127 views

Unable to mail from command-line - public/pickup: No such file or directory

Attempting to send mails using mail(1) from the macOS terminal shell results in the following message and the mail is not sent. postdrop: warning: unable to look up public/pickup: No such file or ...
0
votes
1answer
26 views

Command Line for Enable Dragging

In MacOS, in the Accessibility widget (in System Preferences) if you scroll all the way down to 'Mouse & Trackpad', and then click on the 'Trackpad Options' button, there is a by-default-unchecked ...
0
votes
2answers
54 views

Disk usage in Mac terminal not working with --max-depth

I want to see my disk usage for a specific folder with a pre-set maximum depth. On Linux, the command is $ du -h --max-depth 1 On macOS Mojave (10.14.5) with bash version 3.2.57(1)-release, this is ...
0
votes
1answer
41 views

How to find the process id for the app instance created by “open” command

When I programmerly do open -F -W -n -g -a /Applications/Safari.app/Contents/MacOS/Safari https://kernel.org, I got back the process of open and its pid 93930. But that's not the process (93931) of ...
2
votes
1answer
37 views

How to find the PID(s) of a hung app in macOS from the shell (Terminal)?

Within Activity Monitor.app it's easy to visually identify a hung app by seeing its name in red text: How can such hung app statuses be identified from the shell (Terminal.app) and the PID(s) of ...
1
vote
1answer
36 views

how to reset $SHELL variables in root from user space

I've switched my bash to zsh in root using chsh -s /usr/bin/zsh root After when I change back to bash, I type the wrong path: chsh -s /usr/bin/bash root Now I cannot enter root and I get this ...
0
votes
1answer
16 views

Unable to open a UDP port with nc

On ubuntu, I can open a UDP port: nc -lu 5555 Then in another terminal window, send a message: echo "hello" | nc -u localhost 5555 The message is received at the listener side, as expected. ...
2
votes
2answers
65 views

Change output format of “top” command in Mac OS for memory usage?

I am using the top command in Mac OS from this answer to grab memory usage: $ top -l 1 -s 0 | grep PhysMem PhysMem: 5490M used (2569M wired), 11G unused. Can I go from that to possibly printing out ...
0
votes
1answer
23 views

Convert .cda audio file to m4a [duplicate]

I wanted to use ffmpeg ffmpeg -i file.cda file.m4a but I get the error Invalid data found when processing input So how can I convert lots of cda files on macOS?
3
votes
1answer
141 views

How do I install beta command line tools using softwareupdate -l on 10.14.5?

On a clean install of 10.14.5: Multiple reports of the beta version not working using a headless install: https://github.com/Homebrew/install/issues/206 This lead me to trying to manually do a ...
1
vote
0answers
44 views

Uninstall Xcode 11 beta 1 Command Line Tools accidentally installed in public release of macOS Mojave? [duplicate]

Yesterday I ran the system update and mistakenly installed Command Line Tools for Xcode 11 beta 1 in a system running macOS Mojave. This update is breaking some of my dev applications. I would like ...
3
votes
1answer
33 views

Entering path containing spaces in Terminal

Working on my MacBook Pro, I want to change the location of my iPhone backup to an external drive, but when entering the command on the CLI I hadn't noticed that the destination drive has a space in ...
3
votes
3answers
304 views

Remove sudoers using script

At the moment I'm working on a solution to prevent all admins users (except one particular) from running sudo. I can add a specific user to sudoers by running: sudo -i echo '$username ALL=(ALL:ALL) ...
1
vote
0answers
48 views

updated os to mojave 10.14.5, now lsof is giving me errors with stat

I had a system update last Thursday and ever since I have been getting the errors below. I have tried reinstalling lsof via homebrew, upgrading bash, rebooting, but no luck. How do I even go about ...
4
votes
3answers
326 views

Can't connect to Internet in bash using Mac OS

My browser works perfectly using the using Internet, however, when I tried to use this command in bash: ping -q -w1 -c1 google.com &>/dev/null && echo online || echo offline It gives ...
1
vote
1answer
50 views

Why does sed -i create random files with “q” commands?

I’m aware that BSD sed behaves differently from GNU sed with regards to the -i option. However, the usual way of using sed -i '' on macOS ceases to work when using a q command, and I’m wondering ...
0
votes
0answers
19 views

Forward deleting (Macports/bash): Is there an alternative to Fn+Delete and Control+D?

As a more general version to this question, is there a way to forward-delete in a bash terminal that doesn't involve Fn+Delete or Control+D? Motivation: When using the Macports port command ...
1
vote
1answer
27 views

transfer video file to iphone from macbook over shared internet connection

My iPhone is USB-connected to my macbook and my macbook has internet sharing turned on. How can i send a video file from my macbook to the iphone using the command line?
2
votes
0answers
79 views

Turn on Internet Sharing from Terminal (on Mojave)

In System Preferences > Sharing, there is a way to turn on Internet Sharing so that devices connected to my laptop can use its Internet connection. Start/stop internet sharing from a script? ...
0
votes
1answer
29 views

How to forward delete in Macports?

When using the interactive Macports shell (running port), is there a way to delete characters to the right of the cursor? Normally, you can simply use key the combination Fn + Delete to forward-...
1
vote
0answers
91 views

macOS Mojave Command line: How to mount drive but NOT EFI and hidden partitions

If I connect a external GUID-Formated Mac Drive, the Finder does mount all partitions except the "hidden" ones EFI and if existing "Recovery HD". That's fine so far. If I unmount the disk in the ...
0
votes
0answers
15 views

The cli history is unexpectedly gone - any way to find out what happened?

My cli history is empty for no reason I can see. Is there any way to find out what happened?
0
votes
0answers
82 views

Sysadminctl - sudo vs no sudo/interactive vs non-interactive

I have a Mac with Mojave installed on an APFS partition. I run sysadminctl to change the Secure Token status for some users. Based on the information I found on the web it wasn't clear to me how I ...
0
votes
1answer
61 views

How can I download files from Linux to macOS only using the existing SSH connection?

How can I download files from Linux to my Mac OS using only the existing ssh connection? I know if I use the Windows System, I can use lrzsz to down files: yum install lrzsz sz file // there can ...
2
votes
0answers
35 views

Terminal commands are not being saved

I am on Mojave 10.14.4 and my terminal literally has 100 or so commands in its history when it should have ten times that. It seems as though it never saves the commands, whether I open the terminal ...
0
votes
2answers
130 views

Connect and run commands over SSH using script

I'm using a series of commands for deploying my files to production. This is currently done manually. Is it possible to make these commands into an executable file? So that I don't have to copy paste ...
0
votes
0answers
25 views

Save Terminal app's multiple tabs' output with a single click?

If one has many many Terminal windows or tabs, is there a way save all of the app's tab's output with a single click or command instead of choosing the Shell > Export Text As option countless times to ...
1
vote
1answer
59 views

How to Install Clang specifically

While trying to run a MATLAB script, I am getting the following error: Compiling minFunc files... Building with 'Xcode with Clang'. Error using mex xcrun: error: invalid active developer path (/...
2
votes
3answers
44 views

Move file with specific extension from a directory hierarchy to a destination

I have a directory hierarchy containing many images with .jpg file-extension, and there are multiple folders containing these images. There are many .json files as well in these folders. Is there a ...
0
votes
1answer
31 views

result returns just new line \n not whats printed after command is run

Ultimately I'm trying to catch some errors that are popping up but aren't getting returned. Here's the command I'm trying to run. /usr/bin/dscl . -change /Users/admin NFSHomeDirectory /Users/admin ...
0
votes
2answers
182 views

Change file creation date to modification date using terminal

So I have a bunch of pictures that have incorrect creation dates but their real creation dates are the same as the current modification dates. Is it possible to correct this using some batch command ...