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
1
vote
2answers
2k views

trouble installing cmake

I need to install cmake for school. I have tried using the source code but don't really understand where I should unpack it and how to add it to my path. I also tried the .dmg file but the command ...
0
votes
0answers
10 views

Including virtual environment in bash prompt

I am using bash on MacBook Air running macOS Mojave and wanted to change the color of terminal prompt. I was helped on this question on SO and this IBM blog after which I used export PS1="\[\e[...
2
votes
1answer
24 views

MacOS zsh alias pwd is incorrect

I recently switched to MacOS and some aliases in ZSH which were working on a linux system is giving me headaches in MacOS. To be specific, pwd variable inside alias is using the same directory where ...
3
votes
2answers
1k views

Startup Disk full - Read-only- cannot boot Mac Mini

I'm at my wits end with this issue. Hours of searching various forums have produced glimmers of hope, but nothing works. First - mea culpa - I have only myself to blame. Short Version: I wiped my ...
10
votes
3answers
4k views

AirDrop: How to access AirDrop from command line?

I was looking for an option to use Airdrop to sync a set of directories between two computers. I want to achieve this wirelessly (hence chose Airdrop without having the computers connect on a network ...
21
votes
5answers
8k views

copy last command in terminal

I can see last command in terminal by pressing up arrow as in following example: I typed cd /: Makss-Mac:~ maks$ cd / ... pressed enter, command cd / executed and now I can press up arrow and see ...
0
votes
0answers
29 views

.command The file could not be executed because you do not have appropriate access privileges

I am trying to execute a terminal command by just double clicking a .command file. But I am getting this error. The file “myfile.command” could not be executed because you do not have appropriate ...
4
votes
1answer
355 views

Is the a CLI way to download all photos from a Photos.app iCloud shared album?

Is there a way from the CLI on MacOS or Linux to download all the photos from a shared photo album (an album shared with me from another iCloud user, that shows up the shared tab on iOS or under the ...
1
vote
2answers
80 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 ...
1
vote
1answer
35 views

Lock macOS with a password from bash

Is there a way to lock macOS so that waking it up requires the user’s password? (Even If normally the password won’t be requested if it is waked up in, say, 1 hour)
121
votes
5answers
66k views

Need a cli to check the sha256 hash of a file

To check the sha1 of a file I would use openssl sha1 <file> I'm not sure what to use to check the sha256 hash of the file however, what would you recommend?
1
vote
1answer
68 views

How to terminate cleanly another session left running?

I am the admin on a shared MacOS X: Big_server running Yosemite. The version of MacOS isn't a key information: I had the same kind of problem on all versions of MacOS. But today I have a practical ...
240
votes
4answers
186k views

What is the difference between .bash_profile and .bashrc?

To make an alias for the Terminal in OS X, you can either put the aliases in .bash_profile or .bashrc. What is the difference between the two and why would I choose to put aliases in one and not the ...
1
vote
2answers
24 views

Command Line for Final Cut Pro Import?

Is there a command that I can use for importation of files into Final Cut Pro? I tried this next command but Command-O is not the way to import files. open -g -a "/Applications/Final Cut Pro.app" /...
1
vote
1answer
229 views

Specific: effect of rm -r /./*

I was trying to delete files inside the current directory with rm -r /./* command. When executed it warned me about removing "...Siri..Application". I kind of panicked, thinking it's trying to delete ...
6
votes
1answer
89 views

Terminal Displays My Roommate's Computer

I don't know how long ago this happened, but today I realized that when I open up terminal it no longer says Matthew-MacBook:~matthew$ as it used to. Instead, it appears to have synched up with my ...
1
vote
1answer
34 views

Symbolic links are not working [closed]

when I create a symbolic link ln -s /source.txt destination.txt and then try to cat destination.txt, open destination.txt or simply drag that file onto TextEdit it gives me some machine code instead ...
83
votes
5answers
46k views

Linux' `ps f` (tree view) equivalent on OSX?

How can I get a tree view like the one below on OSX? vartec@some_server:~$ ps xf PID TTY STAT TIME COMMAND 11519 ? S 0:00 sshd: vartec@pts/0 11520 pts/0 Ss 0:00 \_ -bash ...
1
vote
0answers
18 views

How do I make a new terminal window that is a child process of another one?

How do I make a new terminal window that is a child process of another one? for example, If I am in one terminal and I do export zzz=123 then a child process should have $zzz . If I do cmd-n ...
0
votes
0answers
49 views

Still looks bash

I've already changed shell to zsh, but my terminal still looks like bash. What I've done: Install Oh My ZSH via curl. Run cash -s /bin/zsh in terminal. They said once you restart the terminal you'...
0
votes
0answers
19 views

macOS: how to set a custom lock screen delay (from command-line)?

In MacOS, if I don't like the System Preference's provided options in the dropdown "Require password [...] after sleep or screen saver begins", is there a way to set it to a different value, ...
1
vote
0answers
20 views

Hide SSID from the list of available wifi networks in macOS?

Is there any way to hide particular SSID names from the list of available networks? Below command gives list of wifi networks, /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/...
8
votes
2answers
8k views

How to tell if I'm using HFS+ or APFS?

Using diskutil, or other command line tools, how can I determine which filesystem I'm using? # sw_vers ProductName: Mac OS X ProductVersion: 10.8.5 BuildVersion: 12F45
5
votes
2answers
7k views

macOS equivalent of the “where” command used in a Windows Command Prompt

In a Windows Command Prompt, I can find the location of things like Java and GIT by using the where command. For example, typing where java yields C:\Program Files\Java\jdk1.8.0_05. What is the ...
1
vote
2answers
64 views

Using command line how to open a specific section of GUI System Preferences?

It is possible to open a specific section (sub section) of the GUI System Preferences via command line terminal? Example: If I want to open just the main System Preferences window, I just run open /...
0
votes
2answers
44 views

How do I write folder-agnostic shell script on Mac as I can do in Windows?

I would like to write a set of shell scripts which would execute smoothly on Mac disregarding where they are called from. I am currently struggling about how to implement this. On windows, I could ...
147
votes
8answers
65k views

iTerm - going one word backwards and forwards

Would it be possible to configure iTerm 2 to go backwards and forwards one word through the curent text in the command line using a keyboard shortcut?
3
votes
1answer
65 views

Mac Terminal Padding

Is it possible to add window padding to Terminal.app? Here's how it looks currently ... and here's how I would like it to look ... iTerm2 with padding
8
votes
2answers
217 views

Pipe to mv command

I'm trying to move files from Terminal but only those from the results of a grep query. ls -l | grep -i s02 | mv What is the best way to complete the command above?
6
votes
4answers
9k views

Where is “mkpasswd” for OSX?

There is a well-known unix utility called mkpasswd available on many *nix systems. I was just trying to use it from terminal on an OSX 10.10.5 Yosemite (Early 2015) machine, and it is nowhere to be ...
17
votes
5answers
45k views

sudo killall coreaudiod MAde it so I don't have any volume at all

I ran into an issue where my volume buttons on my mac weren't able to adjust the volume of my computer. I sought a solution and someone suggested using sudo killall coreaudiod. Now I have no volume on ...
301
votes
12answers
170k views

How can I trigger a Notification Center notification from an AppleScript or shell script?

I'd love to be able to take advantage of 10.8's Notification Center features in AppleScripts and shell scripts I write. Is there a built-in command or a third-party library I can use from either an ...
2
votes
1answer
14 views

Is there a way to suppress valid files beginning with dot (.) in a tar archive giving false errors and files?

I have a tar compressed archive created on a linux system that has valid files in a directory beginning with dot (.). When I extract that tar file on a Mac, tar thinks that the dotted file is a ...
3
votes
2answers
31 views

Homebrew uninstalling fails

I am trying to uninstall a cask using homebrew, but each time it fails due to (I believe) AppleScript failing to run. I believe this issue stems from my multiuser setup (I am a non admin). Error: ...
1
vote
0answers
13 views

How to restore Dock Icon Badges after killall Dock?

I need to run killall Dock in a script I use regularly, in order for it to work. Unfortunately all the badges in the Dock disappears when Dock is killed, and don't reappear until they're modified ...
60
votes
15answers
46k views

How to get a notification when my commands are done

I'm running a series of commands on the command line that takes approximately twenty minutes to complete. I'd like to see some sort of notification on my Mac when these are finished so I don't need ...
2
votes
1answer
288 views

status line in iterm integrated with tmux

I was trying to set the iTerm and tmux integration and found that panes could be displayed as iTerm2 window splits, if I run tmux -CC. But there is a problem, this 'simulation' of tmux does not have ...
4
votes
1answer
507 views

How can I make multiple directories in Mac OS terminal?

I'm trying to make multiple folders at once but when I press enter it says: mkdir: i/like: No such file or directory. I do this mkdir i/like/icecream I think I have the latest version of python. Any ...
4
votes
1answer
8k views

How to open a shell script in a new Terminal window and run it with administrator privileges

I need to programmatically open a shell script in a Terminal window and run it with administrator privileges. I'm using osascript as it displays a convenient prompt for an admin login/password. I'm ...
4
votes
3answers
7k views

Any way to reboot a iDevice that is connected to a USB port via terminal (Mac terminal)?

So, I am making a program to reboot iDevices (if there power buttons are broken), is there any way to induce the iDevice to reboot via the Mac shell?
1
vote
1answer
24 views

Disable dictation from command line

Is it possible to disable dictation from the command line, so that macOS never asks again if I want to enable it? I know that many such things can be done using defaults write but couldn't find the ...
44
votes
5answers
27k views

How can I combine multiple PDFs using the command line?

Is there a quick one-liner to combine multiple pdfs into one? I know it can be done using Preview.app
6
votes
2answers
196 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....
18
votes
5answers
9k views

How can I add reminders via the command line?

Once in a while it may be useful to add some reminders to Reminders.app from the command line — especially because they are synced to iCloud. Is there any way to do so? A solution that does not rely ...
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
28 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
32 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 ...
6
votes
3answers
17k views

How can I make an Automator service run a shell script and display the output?

I'm using Automator to run a shell script (ffmpeg transcode to h264) as a 'Service', so that I can just right click the high res .mov file and select the service. It works fine, but as it's ffmpeg it ...
9
votes
2answers
215 views

Is there a command on Mac can show the disk IO input and output stats?

I can use vmstat on ubuntu linux to show IO input and output stats. Whether there is a build-in command in MacOS do the same output? procs -----------memory---------- ---swap-- -----io---- -system-- ...
12
votes
2answers
2k views

Does Apple provide a web site with content of `man` pages for the command-line commands bundled with Mac OS X?

I want to provide URL links to man page content at apple.com as an authoritative source of information. Describing and quoting the local man page is awkward. Does Apple provide man pages on the web?