Questions about the command line and other Unix-like aspects of Mac OS X, including the Mach/BSD-based kernel and FreeBSD-based userland. You may want to consider using Ask Different instead.

learn more… | top users | synonyms (1)

4
votes
1answer
314 views

/etc/paths in OS X and other Unices

Is /etc/paths read by every shell that I run in OS X? For example, if I use zsh, will it parse /etc/path to populate $PATH? What exactly is the sequence that OS X follows to populate $PATH? Does it ...
3
votes
2answers
204 views

Loop through file and make every word a variable?

I have a text file that looks like this: 1923.12.312. Nikl 12391.123.123 Jo 12398123.123912 Ad I am trying to loop through this file, and make 1923.12.312. variable1, and Nikl variable2 then use ...
2
votes
0answers
45 views

readline - use of modifiers other than control and meta

I'm trying to use Apple's ⌘ command and ⌥ option keys to map some functions in readline to no avail. As per the man page I used octal values but that doesn't seem to work \xHH the eight-bit ...
0
votes
3answers
185 views

Crontab on Mac OSX

I have created an /etc/crontab file on a Mac OS X that runs a few simple commands. I would like to use the crontab to echo a statement in my terminal, logout from the OS (as if I was to point my mouse ...
1
vote
0answers
18 views

What does UniqueID do on Mac OS X?

Scripts to create a new user on OSX typically use the command dscl to set a user attribute UniqueID. What does UniqueID do and how should I determine what to set it to?
1
vote
1answer
286 views

Error when exporting the result of a valid command as a bash variable

I'm trying to export the result of a command line as en environment variable. Here is how I'm doing it: group_id=$(aws ec2 describe-security-groups --filters Name=group-name,Values=${group_name} \ ...
1
vote
1answer
63 views

Checking Macbook Pro Retina SSD life

I am trying to assess the health of my SSD drive (of a MBPr 15" mid-2014). I tried to do smartctl -a disk0, which gave the following output: SMART Attributes Data Structure revision number: 40 Vendor ...
1
vote
0answers
19 views

Can I specify partition in “reboot” or any similar commands?

I like to make scripts for everything that takes a bit of time, and when I have to reboot to another partition, I press the reboot button and then hold alt (⌥) and then I have to choose partition. I'd ...
0
votes
0answers
102 views

Linux Mint partition doesn't appear in Disk Util (El Capitan).

i have two problems here! I'm pretty new to dual booting on OS X, I'm trying to dual boot with Linux Mint. I've gone through all the recommended route of dual booting. I started with mounting the ...
0
votes
1answer
48 views

Can't boot Mac OSX 10.9 Virtual Machine (Virtual Box)

Whenever I try to run the virtual machine this error comes up: Failed to open a session for the virtual machine Mavericks. UUID {d2b7e883-8f73-41fc-9fde-11bc09a1a548} of the medium ...
34
votes
4answers
44k views

How to persist ulimit settings in OSX Mavericks?

Before Mavericks, one could use /etc/launchd.conf to persist ulimit settings, for example: limit maxfiles 16384 unlimited limit maxproc 16384 unlimited It no longer works in Mavericks. What is the ...
0
votes
0answers
18 views

Bash previous command refresh is messed up [duplicate]

I'm running on a mac with el Capitan. I'm at the command prompt, running bash. When I hit the up-arrow, sometimes it's as if it thinks that my prompt is much longer than it is? The first part of the ...
0
votes
0answers
20 views

Brew Cleanup keeps appearing in my Terminal history

When ever I open Terminal and/or open a new windows in OSX then press the up key, brew cleanup keeps appearing. I tried adding history -c to my bash profile but that did not work. I ran brew update, ...
0
votes
1answer
23 views

set up pfctl to forbid local applications accessing a specific hostname

I am an OSX user, and I want to ban some hostnames, with which some local applications may do nasty things. pfctl is the default firewall on OSX 10.11 El captain. So, how to block the specific ...
1
vote
1answer
104 views

How can I replace a literal \n with a newline character? (on OS X) [duplicate]

I have a script which pulls something out of my shell history and saves it to a file, but if there is a newline in the history entry it gets returned to me with a literal \n instead of the newline ...
1
vote
2answers
225 views

Can't mount shared folder on Linux VM

Host machine: OS X El Capitan Virtual machine: Linux Red Hat(64-bit) through Virtual Box Goal: share folder on Mac, so when I change files on host machine, they will be changed on the virtual ...
8
votes
10answers
48k views

Install rEFInd on OS X 10.10 Yosemite

I want to dual boot my macbook with Arch Linux and thus tried to install rEFInd using the install script, however, after install rEFInd doesn't seem to start at all? Anyone experienced the same issue ...
0
votes
0answers
29 views

Cannot use pcilib

I want to use lspci in command line, but it outputs pcilib: Cannot open AppleACPIPlatformExpert (add boot arg debug=0x144 & run as root) lspci: Cannot find any working access method. Then I ...
2
votes
2answers
302 views

How can I *automatically* backup my contacts in Google Contacts/Gmail?

On a similar theme to this question, how can I automatically (on a schedule) back up my contacts from Google Contacts/Gmail from the command line (Linux or OS X)? Ideally, this mechanism would be a ...
3
votes
1answer
148 views

OS X FileVault 2 duress password

I've been attempting to add a custom script to run after the FileVault password is entered on login that will check whether it a 'special password' that will run a script in the background after ...
2
votes
5answers
192 views

How can I list the names of directories that contain files matching a regex?

Given a directory X that contains several subdirectories and files, I would like to list the names of the immediate child directories of X that (directly or indirectly) contain files matching the ...
1
vote
2answers
3k views

How to configure a fixed user ID on an NFS server?

I'd like my NFS server to always use the same user ID to own the files, whatever user ID is used on the client. Is this possible and how?
1
vote
1answer
42 views

copying and working on OSX .app files (folders) in linux

tldr; I want to run a script over an external hard drive and tar.gz every folder that ends with .app into their own archive. That is, I don't want them all in one tar.gz file, I want to create one ...
0
votes
0answers
31 views

How can I remove Ubuntu from reFind on my Mac?

I used to have Ubuntu installed dual boot on my Mac but have removed it since. The hard disk has been repartitioned into a single Mac OS X partition. However, reFind still shows Ubuntu as one of the ...
1
vote
1answer
873 views

VPN Setup Errors

I'm trying to install a VPN on one of our servers for use within my campus so that we can play some games, but I appear to be getting errors when I try to connect, as shown below. Not quite sure about ...
2
votes
1answer
201 views

Cross compiling ARM static lib with GCC for Mac iOS xCode projects

I'm cross compiling ARM targeted toy example static lib for the usage in Mac iOS xCode projects. In the lib there are only 2 files atoy.c and atoy.h with simple function taking 2 int arguments and ...
3
votes
1answer
386 views

Why can wine run 64bit programs on Linux but not on Mac?

I read about a developer saying it doesn't work, "and probably never will". Why is this? The two OSes aren't that radically different, I think.
1
vote
2answers
60 views

How to change pager key bindings

I'd like to swap RETURN (scroll forward N lines, default one window) and SPACE (scroll forward N lines, default 1) in less to get a for me more natural way to page through man pages. I saw years ...
1
vote
2answers
70 views

Script usually works, but not with cron

I have a script that looks like this: #!/bin/bash D=~/brew\ update num=$(ls "$D" | cut -d ' ' -f 2 | sort -nr | head -1) num=$(( num + 1 )) script -q "$D/brew_update $num" brew update This ...
0
votes
0answers
50 views

OS X admin cannot access user directories or unlock file

This problem is occurring in OS X 10.11.1, but I think the issues pertain to *nix generally. I d/l and installed an app as a limited user (authenticating as an admin when asked). It's not doing what ...
-1
votes
2answers
63 views

“Command not found” for no reason, even when it doesn't try to run a command

This is the errors I get when I try to run my script ~bin/killp: line 7: [[ menubar: command not found ~bin/killp: line 11: [[ menubar: command not found ~bin/killp: line 11:  [[: command not found ...
4
votes
0answers
113 views

rm -rf ~/.Trash/* doesn't work, Mail Attachment.eml:OECustomProperty unable remove [closed]

I'm on OSX10.10.3, I've had a file in my trash for about 6 months or so. I have a file in my trash, 2 actually. That are from my mail cache that I dumped since I don't have the space on my SSD for my ...
0
votes
1answer
46 views

cron doesn't do anything

I tried making some crontabs, I created a file called brewupdater in my user folder, containing 0 */5 * * * ~/bin/brewupdate2. I then tried to run cron ~/brewupdater but it told me: cron: can't open ...
1
vote
1answer
96 views

Why mac os x does not set uid bit for /usr/bin/passwd

A lot of books state that examples of setuid bit usages include passwd, at etc. But in mac os x el capitan, the /usr/bin/passwd does not have the bit set. How could it change the /etc/passwd file?
1
vote
0answers
40 views

Revisiting and learning UNIX [closed]

To get back up to speed on best practices, which UNIX learning resources does the community recommend (slide decks, good videos series, interactive serious games, online virtual learning environments) ...
26
votes
4answers
9k views

Fix or alternative for mktemp in OS X

I'm looking at a bash script someone else wrote that uses mktemp: TEMP=`mktemp --directory` However, this line does not work on my machine (OS X 10.6). How would I fix this line so that it is ...
0
votes
1answer
709 views

Trying to connect to an SSH server on one machine and it works fine. Not on the other [closed]

~$ ssh -v raina@45.79.8.241 OpenSSH_6.9p1, LibreSSL 2.1.7 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: /etc/ssh/ssh_config ...
1
vote
1answer
78 views

how can I stop multiline commands from messing up my cursor position when scrolling through history?

Related: Why is my bash prompt getting bugged when I browse the history? History looks like: 1831 git remote -v 1832 gs 1833 gd 1834 gc -am 'moved apsum options etc to their own file set ...
1
vote
0answers
10 views

How do I make changes in winetricks permanent?

I downloaded a game powered by wineskin X11, it requires videomemory of at least 1GB winetricks works great, but each time I will have to open the dialog, modify it and run the game. Any ideas? I ...
1
vote
1answer
36 views

Scripting Question

I'm trying to write a simple shell script for OS X 10.10, to install a list of applications for new Macs we're getting in. I just want to fire off each installer one at a time to install each ...
3
votes
1answer
43 views

ssh port forwarding through pseudo terminal

Here's a situation: I do all my work on a Mac. There's a certain linux server 'server01' that provides access to another linux server 'server02' via a pseudo terminal So, to ssh into ...
0
votes
1answer
245 views

Formatting USB stick with fdisk - negative used space?

I formatted a USB drive using fdisk, and created three partitions. Everything seems to work fine, but Disk Utility is showing a negative amount of used space for all partitions: Partition | Capacity ...
0
votes
3answers
77 views

Ignore certain characters when comparing variables?

For example, If this is my script: if [[ $yesno == "What's going on" ]]; then Then how do I make it Ignore ', ?, , and . for example? So basically Whats going on, What's going on, What's going on? ...
0
votes
2answers
44 views

seq -w equivalent in os-x bash

I have sub-folders named 00 01 02, ... n with each foldername containing at least 2 digits. I need to access these sub-folders in os-x terminal. The command for i in $(seq -w 00 06); do echo $i; done ...
2
votes
0answers
36 views

Switch to a specified WiFi network via bash on a Mac

I try to connect to a specific WiFi network in a bash script on a Mac. Two things I want to achieve: Connect to the specified network. I have tried networksetup -setairportnetwork en0 [network_ID], ...
1
vote
2answers
67 views

Unzipping file with exclamation mark from command line in bash script

I'm trying to do a simple script that unzips a zip file which has an exclamation mark in its name: #!/bin/bash UNZIP='/usr/bin/unzip' CUT="/usr/bin/cut" GREP="/usr/bin/grep" FILENAME="test" ...
0
votes
2answers
414 views

What's wrong with this grep?

> output2.txt cd # some directory i'm trying to search find views/shared -type f -name "*.js" -print0 | while IFS= read -r -d $'\0' line; do echo -n "${line%.js}" | tee -a ...
45
votes
8answers
162k views

How can I display the contents of a text file on the command line?

I would like to display the contents of a text file on the command line. The file only contains 5-6 characters. Is there an easy way to do this?
0
votes
1answer
120 views

Can I cancel SSH (after using it to browse) without logging out?

I've used the command ssh -D 8080 -f -C -q -N user@IP to SSH into a VPS and set it to browse in the SOCKS proxy settings in System Preferences (on my Mac). How do I cancel the SSH session (and browse ...
1
vote
1answer
85 views

Debian Jessie Nvidia proprietary drivers and screen brightness buttons

How do you make Mac OS X screen brightness work when using Debian Jessie 8 and Nvidia proprietary drivers? There are a lot of answers floating around about editing the config file adding some options ...