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
402 votes
13 answers
244k 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 ...
Nathan Greenstein's user avatar
315 votes
14 answers
535k 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 ...
matt b's user avatar
  • 3,398
21 votes
9 answers
129k 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 ...
Jack Copeland's user avatar
74 votes
13 answers
44k 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?
ocodo's user avatar
  • 1,673
53 votes
1 answer
151k 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 ...
bmike's user avatar
  • 236k
104 votes
2 answers
181k 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 ...
Paweł Brewczynski's user avatar
74 votes
20 answers
62k 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 ...
user40433's user avatar
  • 741
68 votes
6 answers
70k 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?
ylluminate's user avatar
  • 5,321
38 votes
4 answers
32k 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
192 votes
5 answers
87k 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 ...
Gasol Wu's user avatar
  • 4,634
140 votes
6 answers
111k 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-...
sluijs's user avatar
  • 1,513
122 votes
11 answers
63k 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 ...
Fernando's user avatar
  • 1,423
104 votes
6 answers
187k 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 ...
philant's user avatar
  • 2,353
35 votes
5 answers
31k 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: ...
racl101's user avatar
  • 473
22 votes
1 answer
8k 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.
Peter Štibraný's user avatar
14 votes
1 answer
9k 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 ...
bmike's user avatar
  • 236k
284 votes
14 answers
551k 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&...
romeovs's user avatar
  • 4,373
192 votes
15 answers
102k 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 ...
Joe's user avatar
  • 5,049
62 votes
2 answers
16k 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 ...
Jonas's user avatar
  • 6,272
36 votes
4 answers
64k 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 ...
Andrew Wonnacott's user avatar
29 votes
4 answers
47k 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, ...
bmike's user avatar
  • 236k
75 votes
2 answers
91k 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} ...
Danijel-James W's user avatar
52 votes
7 answers
76k 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 ...
Jason's user avatar
  • 620
31 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 ...
dacracot's user avatar
  • 473
28 votes
4 answers
19k 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 ...
knishka's user avatar
  • 425
18 votes
11 answers
29k views

Removing uninstalled Command Line Tools from AppStore updates

I have deleted the Xcode Command Line Tools from my machine by essentially removing the folder. However, AppStore still shows updates from the CLI tools, which obviously I don't want. I've been ...
Kenny Lövrin's user avatar
17 votes
2 answers
13k 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, ...
Josh's user avatar
  • 8,646
13 votes
1 answer
8k 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 ...
JJ Zabkar's user avatar
  • 138
10 votes
4 answers
20k 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 ...
kenorb's user avatar
  • 12.7k
528 votes
12 answers
259k 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?
syntagma's user avatar
  • 10.9k
132 votes
3 answers
1.2m views

How to open files in another app via Terminal on macOS?

I want to open videos and pictures from my command line shell. Is there a way terminal app can do this?
abhimanyuaryan's user avatar
70 votes
8 answers
55k 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 ...
also's user avatar
  • 873
36 votes
5 answers
61k 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' |...
0xPingo's user avatar
  • 633
34 votes
4 answers
15k views

Is there a way via the command line to cause .icloud files to download?

Under iCloud in the Settings app, I have "Optimize Mac Storage" checked and "Desktop & Documents Folders" checked under "Apps that store documents and data in iCloud will appear here:" This will ...
edt11x's user avatar
  • 473
31 votes
5 answers
14k 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 ...
d0g's user avatar
  • 3,902
26 votes
9 answers
17k 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 ...
Razvan's user avatar
  • 363
26 votes
7 answers
23k 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 ...
Louis B.'s user avatar
  • 475
26 votes
2 answers
34k 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. ...
threenovation's user avatar
20 votes
1 answer
54k 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 ...
MrMage's user avatar
  • 1,160
19 votes
3 answers
11k views

How can I force command-line arguments to a program shortcut in the dock?

I have Chrome installed in Applications, and a shortcut to it in the Dock. How can I achieve to force some command-line arguments to each start-up of this app? Let me be clearer, in the Terminal, I ...
ptpdlc's user avatar
  • 923
15 votes
2 answers
6k 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 ...
Dark Star1's user avatar
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 ...
dkagedal's user avatar
  • 232
7 votes
2 answers
2k 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 ...
bmike's user avatar
  • 236k
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 ...
DisplayName's user avatar
  • 2,003
1 vote
3 answers
5k 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 ...
Sevana Ahmadzada's user avatar
145 votes
16 answers
165k views

What directory comparison tools can I use on OS X?

I am looking for a tool that is able to compare directories, not only files. Also it is important to be able to call the tool from the command line. It would be great to have a free tool, but feel ...
sorin's user avatar
  • 29.9k
71 votes
19 answers
149k 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 ...
titaniumdecoy's user avatar
43 votes
7 answers
96k 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.
michelemarcon's user avatar
34 votes
16 answers
76k views

How to retrieve current wattage info on OS X?

Is there a way to retrieve the current watt usage info on OS X Snow Leopard? I'm using mid-2010 iMac, so I'm not looking for just battery-related apps. Does OS X even monitor power usage? Do I need to ...
Jari Keinänen's user avatar
32 votes
4 answers
97k 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?
Rolf van de Krol's user avatar

1
2 3 4 5
10