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
370 votes
13 answers
215k 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 ...
user avatar
20 votes
9 answers
120k views

Terminal returns not found for most commands Mac OSX

I'm really new to Mac OSX and UNIX based systems. I wanted to run a few Windows games on my Mac Mini so I started installing Wine and MacPorts. I think the installs are correct, but when I type sudo ...
user avatar
297 votes
12 answers
481k views

Can I get the CPU temperature and fan speed from the command line in OS X?

Is there a command I can run from the command line in OS X to get the current CPU temperature and/or the fan speed(s)? To be more specific, I'd like to be able to get the same info available in the ...
user avatar
  • 3,218
68 votes
12 answers
39k views

How can I change a file or folder icon using the Terminal

How can I change or set the icon for a file or folder, in the terminal, do I need to use a scripting language?
user avatar
  • 1,592
104 votes
2 answers
175k views

Why doesn't Mac OS X source ~/.bashrc? [duplicate]

I found a lot of people figuring out why instruction similar to this : Put X to your ~/.bashrc and you can do Y don't work. It always turns out that Mac OS X's bash's startup files (or Mac's Bash ...
user avatar
47 votes
1 answer
126k views

How do I uninstall the command line tools for Xcode?

We have a bunch of Mac at work that no longer require Xcode or command line tools so we'd like to remove them so the compilers aren't hanging around and we don't have to keep updating them when ...
user avatar
  • 221k
69 votes
20 answers
55k views

Lock Screen Command One-Liner

I'm trying to find out whether there is any kind of equivalent command line one-liner which replicates the exact identical functionality of the 'Lock Screen' menu option available via the Keychain app ...
user avatar
  • 691
67 votes
6 answers
68k views

How to get BSD FTP and Telnet back in 10.13 (High Sierra)?

There are some real problems with not having ftp and telnet present in 10.13 now as per Apple's dictate. Has anyone found a solid way to bring BSD ftp and telnet back to macOS vs using inetutils?
user avatar
  • 4,722
117 votes
11 answers
55k views

How do I speed up new Terminal tab loading time?

How can i speed up the terminal startup in Lion? I'm not referring to the startup of the Terminal application, but to the startup terminal windows, like when i open a new tab. I don't have anything ...
user avatar
  • 1,373
87 votes
6 answers
151k views

Is there a command to install a dmg

I want to install a dmg file on a remote server. All I have is an ssh access. Since a DMG is a disk image, I tried to mount it, but mount does not seem to recognize its format. file says my dmg file ...
user avatar
  • 2,023
22 votes
1 answer
7k views

Is there console mode in Mac OS X?

Is there something like Linux console in Mac OS X? Like "terminal", but without running graphics environment.
user avatar
36 votes
4 answers
27k views

Can running `yes > /dev/null` harm a Mac?

I recently ran yes > /dev/null for a 3 minutes to drain my Mac's battery. During that time, the temperature rose to 72 °C and fans spun up to 4000 RPM. I immediately quit the process. Should I ...
user avatar
32 votes
5 answers
28k views

My Automator Workflow fails because it fails to find the git command within the 'Run Shell Script' command? Need help

I have an Automator workflow and one of the actions is to clone a repository. Here's the code for the 'Run Shell Script' action. The command is run within the Bash shell /bin/bash if that matters: ...
user avatar
  • 433
14 votes
1 answer
8k views

Is there a script I can use to download the Mojave installer without being signed in to the App Store?

Is there a way to script and download the Mojave installer without signing in to the App Store? Something other than opening or clicking a url that points to the installer on the Mac App Store would ...
user avatar
  • 221k
262 votes
13 answers
500k views

Why doesn't .bashrc run automatically?

I put some alias commands in my .bashrc file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen. I have to select run script: in the Terminal>Preferences&...
user avatar
  • 3,993
169 votes
15 answers
87k views

How to move files to trash from command line?

I do a lot of terminal work, and today had the experience of typing rm fileInQuestion.txt Before finding out that I did actually need fileInQuestion.txt. If I'd deleted in the GUI then I would have ...
user avatar
  • 4,749
27 votes
4 answers
45k views

What steps are needed to create a new user from the command line?

What commands (or script) can create a fully functional user account on Mountain Lion, running only from the command line via terminal or ssh. It looks like an existing pair of answers might work, ...
user avatar
  • 221k
60 votes
2 answers
14k views

Where should I store command line applications?

When I download command line applications they are located in my ~/Downloads/ directory. But I feel this is wrong place to have a command line application located. Where in the Mac OS X filesystem ...
user avatar
  • 5,473
32 votes
3 answers
59k views

How to control Bluetooth wireless radio from the command line?

This question is almost the same as my previous question, but with one major difference; I want to turn on/off Bluetooth from the command line (bash or similar), NOT from AppleScript - the answers for ...
user avatar
123 votes
7 answers
85k views

Update bash to version 4.0 on OSX

Is it possible to actually update bash to version 4.0 in OSX Yosemite? echo $BASH_VERSION 3.2.57(1)-release This article and this thread refer to the same question, but they install a new shell side-...
user avatar
  • 1,343
69 votes
2 answers
83k views

Run AppleScript from bash script

If I wanted to run an AppleScript from within a bash script I could call a file with the list of commands that I require to execute. #!/bin/bash {some commands} osascript file.scpt {other commands} ...
user avatar
51 votes
7 answers
75k views

How to always show menubar with fullscreen apps?

Does anyone know if it is possible to keep the menubar in Mac OS Lion visible for fullscreen apps instead of hidden until hovered over with a mouse or trackpad? I imagine there's some Terminal ...
user avatar
  • 610
30 votes
5 answers
33k views

How do I take a steathy picture with my iSight camera from the command line?

Is there a command line utility that allows me to take a picture from the built in camera? Something like screencapture allows for, well, screen captures. The reasoning for a command line tool is I ...
user avatar
  • 463
23 votes
4 answers
17k views

Change file association in terminal?

Is there a method for associating file types with applications via terminal? I thought ~/Library/Preferences/com.apple.launchservices.plist might do it, and I also have seen: Why is a command line ...
user avatar
  • 375
12 votes
1 answer
6k views

How do I create a static permanent ifconfig alias?

How do I get this ifconfig loopback alias change to persist after a restart? $ sudo ifconfig lo0 alias 172.16.222.111 $ ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 ...
user avatar
  • 128
26 votes
2 answers
32k views

Amending PATH so that /usr/local/bin is ahead of /usr/bin

I'm trying to install brew but get the following warning: Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. ...
user avatar
24 votes
9 answers
16k views

How to enable/disable Do Not Disturb from shell on Mavericks?

I would like to toggle the Do Not Disturb in the notification center with a keyboard shortcut. I am using BetterTouchTool for some extra keyboard shortcuts but it does not support enabling/disabling ...
user avatar
  • 343
29 votes
5 answers
12k views

How to programatically add folder to Spotlight "do not index"?

Is there any way to programmatically add a folder to Spotlight's "Privacy" tab? Either through Terminal or Applescript? Often I want to click on an item in Spotlight results in Finder, and have that ...
user avatar
  • 3,632
14 votes
2 answers
4k views

why does OSX add extra '._<filename>' when I tar a directory?

I'd just like to know why if I "tar -czf" a file/directory, osx adds a: ._ for each file? I see these when I untar in linux. Or when I work with the uncompressed project in eclipse as it doesn't ...
user avatar
20 votes
1 answer
48k views

Create new partition in unallocated space with diskutil

I have deleted the first partition on my external HD such that it now has 100GB of free space at the beginning of the partition. I'd like to reclaim that space, but Disk Utility doesn't let me create ...
user avatar
  • 1,140
15 votes
7 answers
17k views

Monitor a folder for changes, and run a command when a change is detected

Is there a simple way to automatically run a (Terminal) command every time a file is changed in a specific folder? This should be possible via the command line, or a system built-in application, no ...
user avatar
  • 365
14 votes
2 answers
9k views

Can user accounts be managed via the command line?

Is there any way to add, remove, or modify user accounts via the command line? I'm not talking about an account for a system process or daemon, I mean is there any way to add a user account, change, ...
user avatar
  • 8,298
10 votes
2 answers
16k views

How to dump the content of keychain from the shell?

I'm testing the following command-line in the Terminal: sudo security dump-keychain -d login.keychain which I'd like to use to save all my passwords into a file. However when I run it, it keep ...
user avatar
  • 11.9k
6 votes
2 answers
1k views

Is it possible to use `tmutil delete` or another command to delete one file from all backup intervals?

I'm having problems clearing our a backup drive. I want to get rid of a couple large files so I can preserve the other incremental backups. I can't use the tmutil delete command on entire backups ...
user avatar
  • 221k
4 votes
4 answers
2k views

Is it impossible to delete/move a file named "␀" on mac?

When I try to move, rename, or delete a file named ␀in Finder, I get this error message: The operation can't be completed, because an unexpected error occured (error code -50). With mv, rm or find ...
user avatar
  • 2,075
7 votes
2 answers
3k views

How do I set the creation time of a file?

I have a script that converts a file to another format, and I want the resulting file to have the same timestamps as the original, including the creation time (as shown by ls -lU). I can use touch to ...
user avatar
  • 232
1 vote
3 answers
3k views

How to add the PATH for mysql bin on Mac?

I want to add the PATH for mysql.exe on my Mac. I tried this via terminal, but $ vi.bash_profile vi.bash_profile command not found. does not work. I tried this for generating the bash_profile to ...
user avatar
71 votes
19 answers
148k views

Password dialog appears when SSH private key permissions are set to 0600

I installed my SSH private key in ~/.ssh/id_rsa and set its permissions to 0600. When I connect to an SSH server which uses my private key in Terminal.app via ssh, a dialog pops up and asks me to ...
user avatar
62 votes
8 answers
47k views

How can I install the Command Line Tools completely from the command line?

I'd like to script the installation of the Xcode Command Line Tools. On Mavericks, xcode-select --install will open a dialog prompting the user to install, but I'd like to trigger the install without ...
user avatar
  • 793
148 votes
4 answers
66k views

Suppressing "The default interactive shell is now zsh" message in macOS Catalina

I know Catalina uses zsh as the default login shell and interactive shell, but it is very annoying when I open iTerm.app or run command with /bin/bash, it shows verbose message like below: $ /bin/bash ...
user avatar
  • 3,639
43 votes
7 answers
90k views

How to send an email from command line?

How to send an email from command line or script? I want to be able to run the script programmatically by passing the receiver and the message.
user avatar
36 votes
5 answers
59k views

Check the battery level of connected bluetooth headphones from the command line

I am trying to check the battery level of my wireless headphones from the command line. I came across a few discussions, and it seems all I need to do is enter the following: ioreg -c 'deviceName' |...
user avatar
  • 633
31 votes
4 answers
12k views

Can Mac App Store installs & upgrades be automated?

How can I script installing or upgrading apps from the Mac App Store? I'd prefer command line tools, but AppleScript or some other API would suffice. Relevant puzzle pieces: installer: note ...
user avatar
24 votes
7 answers
15k views

Change display arrangement in OS X/macOS programmatically

I periodically have to move my display around (physically1) and this requires also rearranging my display arrangement in System Preferences. Manually doing this all the time is a pain in the neck. ...
user avatar
  • 7,580
24 votes
4 answers
73k views

How can I set the display settings using command line

I would like to configure the 'Scaled' property of my Macbook Pro display using the command line. How could I do that?
user avatar
19 votes
6 answers
11k views

How to list all available .plist keys on a certain domain application by defaults command?

I want to know all keys (property list) which available on certain domain application, as example I could list available key for com.apple.dock by entering this command: $ defaults read com.apple....
user avatar
  • 513
16 votes
2 answers
4k views

Delete all backups of specific file/folder with tmutil

I'm trying to delete all backups of specific items through the command line. I can accomplish this using the GUI through the following steps: Enter Time Machine Navigate to the file to be deleted ...
user avatar
  • 696
13 votes
4 answers
27k views

Reset your PATH variable

I stuffed up (basically wiped) my PATH variable. Is there any way to reset it to the default? I look at How do I reset the $PATH variable on Mac OS X?, but I find it very confusing. As far as I ...
user avatar
22 votes
5 answers
79k views

How to reset $PATH?

I was trying to add something to $PATH and it went totally wrong. I now can't run any commands such as ls. I've looked at this answer and used the following lines: PATH=/usr/bin:/bin:/usr/sbin:/...
user avatar
  • 451
16 votes
2 answers
13k views

How to change tap to click using "defaults write" from command line?

I want to change the trackpad tap-to-click property from the command line. Graphically, I can do it by clicking System Preferences -> Trackpad -> Tap to Click. How can I do it from the command line? ...
user avatar
  • 339

1
2 3 4 5
9