Mac Command Line Tools Dmg

Dec 10, 2008 The download file is named 'cotvnc-20b4.dmg'. Here are the steps needed to install it remotely from the command line. Note: this technique can be used from a local Terminal window or a remote SSH connection. Mount the disk image. The first step is to mount (or attach) the disk image. From the command line, use: hdiutil mount cotvnc-20b4.dmg.

  • Sep 20, 2015  A new suggestion to install 'Command Line Tools (OS X 10.10) for Xcode 7.0' appeared in App Store. I clicked the button 'UPDATE ALL'. I have a list of 6 'Command Line Tools (OS X 10.10) for Xcode 7.0' 'installled'.
  • Sep 25, 2012  If you're observant enough, you'll see that in the left side panell of Finder you have all the active DMG filesystems listed and ready to be ejected once you finish copying the files or installing new software. Sometimes you may want to download and mount DMG file using Mac OS command line, and in this post I'll show you how to do it.
  • Feb 12, 2014  The Command Line Tool package gives Mac terminal users many commonly used tools, utilities, and compilers, including make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp, what, and many other useful commands that are usually found in default linux installations.

kill, grep, sed, regex, cron, etc. vs. Linux commands

  • You hot?
  • coreutils (Core Utilities)

This article compares and contrasts macOS utilites vs. Linux utilities – the Swiss Army Knife for almost every need.

Uname = Darwin (BSD)

The command that is common to all Linux/BSD variants is the one that returns the operating system name:

Mac Command Prompt

On macOS, the response is “Darwin”.

MacOS (Mac OS X) comes with the BSD (Berkeley Standard Distribution) version of command line tools which are slightly different from the Linux version (in Red Hat, Debian, Ubuntu, CoreOS, etc.) even though both are compliant with POSIX standards.

apt (Advanced Packaging Tool)

On Debian and its derivatives is the apt-cache utility that goes with the apt-get package manager (like Homebrew and MacPorts).They are ported to Mac via https://github.com/KubaKaszycki/mac-apt

  1. Use it to search within Python libraries:

    See https://www.dedoimedo.com/computers/aptitude.html

There is also http://rudix.org/ which is a collection of “the hassle-free way to get Unix programs on OS X”.Its packages include zshell and tig (Git spelled backwards), the Text-Mode Interface for Git.

System Preferences GUI

macOS provides a GUI to manage system configuration settings.

  1. Mouse to the upper-left corner of the screen and click the Apple icon that appears to choose “System Preferences…”.

    Alternately, you can also open the dialog with this command:

BTW, instead of typing out the whole line above, you can simply type “prefs” if you use a text editor to add this line in the ~/.bash_profile file:

Apple stores its apps in folder “/Applications”. The “back-slash” character needs to precede every space character in the name because a space usually separates parts of commands.

BTW There is also a folder at “~/Applications” for user-level apps.

Open a Finder window to view files in both folders.

System information

In folder “/Applications/Utilities” are several apps which include “System Information.app”.

macOS provides a GUI to display detailed information about system Hardware, Software, and Networks. Mouse to the upper-left corner of the screen and hold down Option while you click the Apple icon. “System Information…” appears. But you can also open it without the Option key by selecting “About This Mac” then pressing “System Report”.

Instead of examining various Linux config files (/etc/*elease, /proc/meminfo for memory, /proc/cpuinfo for number of cores), macOS has a “system_profiler” utility presenting many data types.

You hot?

  1. Get CPU thermal data on MacOS

    PROTIP: Add this among your keyboard shortcuts in aliases.sh.

Mac Command Line Tools Dmg

system_profiler

Internally, the display can be output as text using this command:

PROTIP: Use the command above to obtain your serial number for Apple Support.

“SPHardwareDataType” is one of several DataTypes or items of information listed by:

The list output:

There is a lot of information, so it takes time to generate output.

PROTIP: Save these files to provide to Support:

Instead of “basic”, there is also “mini” and “full” scope of output. When providing full scope, output in .spx file extension so that it opens automatically using the GUI:

CPU Utilization uptime

Was your Mac rebooted recently?

The response also shows whether CPU utilization is increasing recently:

“load averages” numbers are calculations of the average system load over three period of times: the last one-, five-, and fifteen-minute periods. These count the number of processes either using or waiting for CPU (the ready queue or run queue) increments the load number by 1. In a system with four CPUs, a load average of 3.73 would indicate that there were, on average, 3.73 processes ready to run, and each one could be scheduled into a CPU.

Memory Statistics

  1. To obtain a new reading every 5 seconds, the command on macOS is:

    The number of most interest is pageout, the “3459” in this sample response:

    On Linux systems, the “vmstat” command is similar but not identical.

  2. To cancel the display, press control+C.

  3. PROTIP: The memory page size is obtained using getconf PAGESIZE, which is “4096”.

See mac-diskspace

Top processes

Is your computer fan loud?

  1. To list the top hungry processes consuming the CPU:

    This refreshes automatically.

  2. To cancel the display, press control+C keys (which works with any process you want to kill). Shareit for mac dmg file.

  3. Alternately, install the htop utility using Homebrew:

    The response includes:

  4. Invoke it:

Processes

  1. So that we can kill it for fun, create a background process (by specifying &) which sleep for 999 seconds:

  2. Get the process identifier:

  3. List background processes:

    The + shows the focus.

  4. To list all processes with a niceness (NI) column:

    Expand the terminal window width to avoid line wrapping.

### Niceness of priority

Default niceness of zero, but can be -20 to +19.

PROTIP: A niceness of +19 is a priority of 99, which is lowest.

root permissions are needed to set nice below zero.

  1. Reset nicer:

    Kill

  2. To kill a single program by name:

  3. To kill several progams by name:

Command Line Tools

  1. To install additional utilities:

  2. List what it installed to folder /Library/Developer/CommandLineTools (containing folders Library, SDKs, and usr):

More on this:

  • XCode version: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/pkgutil.1.html
  • https://gist.github.com/tylergets/90f7e61314821864951e58d57dfc9acd
  • pkgutil –pkg-info=com.apple.pkg.CLTools_Executablesgrep version

USB info

  1. Install the equivalent of Linux usbutils</stong>:

  2. Get the state of kernel objects that the kernel has matched to devices:

    This has the same problem as Linux ioreg - it reflects the state of kernel objects that the kernel has matched to devices, not the devices themselves.*

  3. Alternately, to work same problem as ioreg

lsmod (modules) vs. Apple Kernel Extensions

macOS has Kernel Extensions (kexts) to handle hardware*. Developers and software use the low-level kextload utility to load, kextunload to unload kexts, and kextstat to diagnose problems. There is also the kextutil command.

Although there are no direct equivalent in Linux, the Linux lsmod command lists operating system kernel modules defined in a folder containing “.ko” files:

ls /lib/modules/$(uname -r) -type -f -iname “*.ko”

Such udev rules are loaded in this sequence:

  • /etc/udev/rules.d
  • /run/udev/rules.d
  • /usr/lib/udev/rules.d

coreutils (Core Utilities)

Many who work with Linux distribution avoid minor (but annoying) differences by replacing OS X commands based on BSD with the GNU (Linux) version by installing the “coreutils” family of commands. It’s among Daniel Missler’s The First 10 Things I Do on a New Mac.This is about more than having the same toolset as on Linux machines.See The difference between Linux vs. Mac:

Mac Command Line Tools Dmg 2

  • Native capability to search for Unicode strings are not in the Mac (BSD) version of strings.
  • ANSI-C escape sequences (e.g., r, t) beyond n are not suppoed by the Mac sed command.

See https://en.wikipedia.org/wiki/GNU_Core_Utilities

  1. Get the set of utilities from GNU Linux, but for Mac:

  2. Then you can link:

    NOTE:

  3. NOTE: Add these lines to your .bashrc or .zshrc:

    /usr/local/opt/coreutils

    NOTE: brew --prefix coreutils retrieves the path to the executable in the Homebrew package, which is, at time of writing:

    /usr/local/Cellar/coreutils/8.31

    PROTIP: Using a command to retrieve the path ensures that the version number from being hard-coded and thus possibly wrong.

    Thus, the command is used in ~/.bash_profile to define variables for compilers to find:

    Bash shell

  4. Update Bash to version 4:

    See https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/

    Zsh

    Switching to Zsh from Bash is a rather person choice. But it’s done thus:

    Update Mac utilities

  5. Several utilities come installed on macOS, but can be upgraded to the (newest?) version known by brew:

    Because macOS already provides this software, when brew install runs, as its response message says, formulas for them are installed as keg-only, which means brew did not symlink it into /usr/local and installing another version in parallel can cause all kinds of trouble.”

    So their installation would require placing their location in front of the default program’s location.That’s why many don’t bother.

    Updates specific to text editors:

GNU Debugger

Although with its Mavericks version, Apple (along with the transition from GCC to Clang) substituted GDB (the GNU interactive debugger) with LLDB (the standalone LLVM debugger).

Unfortunately, the Eclipse IDE was not capable of communicating with any interactive debugger other than gdb.

NOTE: Install Xcode (version 7.3.1 is known to work). The simplest way is to get is from the App Store. Once it is installed, lldb-mi will reside somewhere under the Xcode folder (it normally is /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi). CDT will initialize the default LLDB path to this value if it is present. Note that if you had previous debug configurations with a non-default path for LLDB or if you changed the path in the preferences, the path to lldb will not be automatically set for you. You will have to edit the LLDB path manually in the debug configuration and/or you need to reset the preferences to defaults (if it was modified).

  1. Restore GDB back on your Mac:

    The above does not create a ~/.gdbinit folder.

  2. Notice in the response “On 10.12 (Sierra) or later with SIP, “brew info gdb” says you need to run:”

    NOTE: https://sourceware.org/gdb/wiki/BuildingOnDarwin

    1. download the most recent GDB from https://www.sourceware.org/gdb/download/
    2. expand the gdb-7.12.1.tar.xz file: tar xopf gdb-7.12.1.tar.xz
    3. cd gdb-7.12.1 in terminal to open the gdb folder
    4. Follow the instructions in the README file in the gdb folder, or simply follow the following steps:
    5. ./configure, wait for the terminal
    6. make and wait again (which can take some time)
    7. sudo make install
    8. csrutil enable –without debug

    This describes how to code-sign the GDB executable so that macOS will allow it to control other processes.It involves some manual steps.

    codesign -s gdb-cert /usr/local/Cellar/gdb/7.12_1/bin/gdb

    NOTE: To start dbg, use sudo or define alias gdb=”sudo gdb”

    GNU Not pre-installed on macOS

    Tutorials make use of some commands, so install them:

brew install gawk # in /usr/local/bin/gawkbrew install gzip # in /usr/bin/gzipbrew install wget # /usr/local/bin/wgetbrew install screen # in /usr/bin </pre>

Below are GNU packages on https://www.gnu.org/software but not on macOS:

brew install diffutilsbrew install wdiff --with-gettext

–with-default-names prevents Homebrew from prepending a “g” to each command, so they can be used instead of the ones shipped by OS X.

### findutils

Missing from the list above is brew install findutils –with-default-names becuase that causes ‘brew doctor’ to issue warning: “Putting non-prefixed findutils in your path can cause python builds to fail.”

### GPG

https://superuser.com/questions/655246/are-gnupg-1-and-gnupg-2-compatible-with-each-other

### Add to MacOS Non-GNU commands

These are handled by specific request:

### Utilities for Mac only

Dmg

### MoreUtils and parallel

The Debian description for it is “Unix tools that nobody thought to write long ago, when Unix was young.”

Read about each utility command at https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/

  • chronic runs a command quietly unless it fails
  • combine combines lines in two files using boolean operations
  • errno look up errno names and descriptions
  • ifdata get network interface info without parsing ifconfig output
  • ifne run a program if the standard input is not empty
  • isutf8 check if a file or standard input is utf-8
  • lckdo execute a program with a lock held
  • mispipe pipe two commands, returning the exit status of the first
  • parallel run multiple jobs at once (conflicts with brew install parallel, so don’t install that stand-alone)
  • pee tee standard input to pipes
  • sponge soak up standard input and write to a file. See this
  • ts timestamp standard input
  • vidir edit a directory in your text editor
  • vipe insert a text editor into a pipe
  • zrun automatically uncompress arguments to command

Its home page at https://joeyh.name/code/moreutils/ says more are on the way.

Riff on it at https://news.ycombinator.com/item?id=9013570

Openssl

  1. To generate a random set of 32 upper and lower case characters (with special characters) for use as a password:

    Example:

Certificates

http://sourceware.org/gdb/wiki/BuildingOnDarwin

Cron Launchd Background Jobs

This mentions that Apple has deprecatedcron in favor of launchd (a daemon running under the System context).to automatically start (after reboots) service programs at boot time.

If the system is turned off or asleep, cron jobs do not execute until the next designated time occurs.

However, a launchd job will run when the computer wakes up if the computer was asleep when the job should have run(if the StartCalendarInterval key has been set).

Since it’s a background process, launchd doesn’t present a user interface.So you get “launchd cannot be run directly.” when you run launchd like other commands.

The standard way now to run a service on Mac OS X is to use launchd , a program that starts, stops and manages daemons and scripts in Apple OS X environments.

An XML document named with file extension .plist defines its properties. The sample file below defines the Nexus Repository Manager from Sonatype.com installed in /opt:

The above is the com.sonatype.nexus.plist file in /Library/LaunchDaemons/

Change its ownership and access rights:

PROTIP: Consider setting up a different user to run the repository manager and adapt permissions and the RUN_AS_USER setting in the nexus startup script.

To manually start it after the configuration:

Install appium_console gem

Install flaky gem:
https://github.com/appium/flaky
(posix-spawn)

Add wi-fi network

NOTE To avoid the manual effort to add a wi-fi, use this command:

  • my_ssid is the SSID of your network.
  • my_security is the level of encryption (WEP, WPA, WPA2, etc)
  • my_passkey is your encryption passkey for your wireless network.

NOTE:

Shells

nix-shell environment on top of nixos/nixpkgs

Mac Message Reset

https://github.com/mattgraham/dotfiles/blob/master/bash/message_reset

References

https://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities/69332

https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/

http://clarkgrubb.com/diagnostic-tools compares Linux, Darwin, and Windows utilities

http://www.brendangregg.com/USEmethod/use-macosx.html

https://support.apple.com/kb/DL75?viewlocale=en_US&locale=en_USApple’s Common Criteria Tools for 10.5

More on macOS

This is one of a series on macOS (Mac OSX):

Please enable JavaScript to view the comments powered by Disqus.

This topic includes the following sections:

System Requirements for Installing the JDK on macOS

The following are the system requirements for installing the JDK on macOS:

  • Any Intel-based computer running macOS.

  • Administrator privileges.

    You cannot install Java for a single user. Installing the JDK on macOS is performed on a systemwide basis for all users. Administrator privileges are required to install the JDK on macOS.

Determining the Default JDK Version on macOS

When starting a Java application through the command line, the system uses the default JDK.

Mac Command Line Tools Dmg 1

There can be multiple JDKs installed on the macOS system.

You can determine which version of the JDK is the default by entering java -version in a Terminal window. If the installed version is 13 Interim 0, Update 0, and Patch 0, then you see a string that includes the text 13. For example:

To run a different version of Java, either specify the full path, or use the java_home tool. For example:

$ /usr/libexec/java_home -v 13 --exec javac -version

Mac Command Line Commands

Installing the JDK on macOS

  1. Download the JDK .dmg file, jdk-13.interim.update.patch_osx-x64_bin.dmg.

    Before the file can be downloaded, you must accept the license agreement.

  2. From either the browser Downloads window or from the file browser, double-click the .dmg file to start it.
    A Finder window appears that contains an icon of an open box and the name of the .pkg file.
  3. Double-click the JDK 13.pkg icon to start the installation application.
    The installation application displays the Introduction window.
  4. Click Continue.
  5. Click Install.
    A window appears that displays the message: Installer is trying to install new software. Enter your password to allow this.
  6. Enter the Administrator user name and password and click Install Software.
    The software is installed and a confirmation window is displayed.
After the software is installed, you can delete the .dmg file if you want to save disk space.

Mac Command Line Tools Dmg Download

Uninstalling the JDK on macOS

You must have Administrator privileges.

Note:

Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time that you perform an update of the OS.

  1. Go to /Library/Java/JavaVirtualMachines.
  2. Remove the directory whose name matches the following format by executing the rm command as a root user or by using the sudo tool:
    /Library/Java/JavaVirtualMachines/jdk-13.interim.update.patch.jdk

    For example, to uninstall 13 Interim 0 Update 0 Patch 0:

    $ rm -rf jdk-13.jdk

Installation FAQ on macOS Platform

This topic provides answers for the following frequently asked questions about installing JDK on macOS computers.

1. How do I find out which version of Java is the system default?

When you run a Java application from the command line, it uses the default JDK. If you do not develop Java applications, then you do not need to worry about this. See Determining the Default JDK Version on macOS.

2. How do I uninstall Java?

See Uninstalling the JDK on macOS.

3. After installing Java for macOS 2012-006, can I continue to use Apple's Java 6 alongside the macOS JDK for Java 13?

If you want to continue to develop with Java 6 using command-line, then you can modify the startup script for your favorite command environment. For bash, use this:

$ export JAVA_HOME=`/usr/libexec/java_home -v 13`

Some applications use /usr/bin/java to call Java. After installing Java for macOS 2012-006, /usr/bin/java will find the newest JDK installed, and will use that for all of the Java-related command-line tools in /usr/bin. You may need to modify those applications to find Java 6, or contact the developer for a newer version of the application.

4. What happened to the Java Preferences app in Application Utilities?

The Java Preferences app was part of the Apple Java installation and is not used by Oracle Java. Therefore, macOS releases from Apple that do not include Apple Java will not include Java Preferences.

Comments are closed.