Mac OS X from the Command Line In this Mac OS X from the Command Line training course, expert author Chris Tarnowieckyi will teach you all about the command line tools and how to use them. This course is designed for users that are already familiar with Mac OS X. AccuRev® Concepts Manual iii Preface This book is your guide to some of the major concepts of the AccuRev® software configuration management system. Audience This document is intended for both end users and administrators, and goes into more depth than related discussions in the On-line Help and the Administrator s Guide. Learn Enough Command Line to Be Dangerous is available as an ebook, an offline video series, and as a structured, self-paced online course. The course includes full online access to the book content, streaming videos, progress tracking, exercises, and community exercise answers. You can use similar command with rm / accurev pop to force refetch from backend. You can also vary the flags, -m for modified, -k for kept, -a for all.
Bob Savage <bobsavage@mac.com>
Python on a Macintosh running Mac OS X is in principle very similar to Python onany other Unix platform, but there are a number of additional features such asthe IDE and the Package Manager that are worth pointing out.
4.1. Getting and Installing MacPython¶
Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, youare invited to install the most recent version of Python 3 from the Pythonwebsite (https://www.python.org). A current “universal binary” build of Python,which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is availablethere.
What you get after installing is a number of things:
A
Python3.9
folder in yourApplications
folder. In hereyou find IDLE, the development environment that is a standard part of officialPython distributions; and PythonLauncher, which handles double-clicking Pythonscripts from the Finder.A framework
/Library/Frameworks/Python.framework
, which includes thePython executable and libraries. The installer adds this location to your shellpath. To uninstall MacPython, you can simply remove these three things. Asymlink to the Python executable is placed in /usr/local/bin/.
The Apple-provided build of Python is installed in/System/Library/Frameworks/Python.framework
and /usr/bin/python
,respectively. You should never modify or delete these, as they areApple-controlled and are used by Apple- or third-party software. Remember thatif you choose to install a newer Python version from python.org, you will havetwo different but functional Python installations on your computer, so it willbe important that your paths and usages are consistent with what you want to do.
IDLE includes a help menu that allows you to access Python documentation. If youare completely new to Python you should start reading the tutorial introductionin that document.
If you are familiar with Python on other Unix platforms you should read thesection on running Python scripts from the Unix shell.
4.1.1. How to run a Python script¶
Your best way to get started with Python on Mac OS X is through the IDLEintegrated development environment, see section The IDE and use the Help menuwhen the IDE is running.
If you want to run Python scripts from the Terminal window command line or fromthe Finder you first need an editor to create your script. Mac OS X comes with anumber of standard Unix command line editors, vim andemacs among them. If you want a more Mac-like editor,BBEdit or TextWrangler from Bare Bones Software (seehttp://www.barebones.com/products/bbedit/index.html) are good choices, as isTextMate (see https://macromates.com/). Other editors includeGvim (http://macvim-dev.github.io/macvim/) and Aquamacs(http://aquamacs.org/).
To run your script from the Terminal window you must make sure that/usr/local/bin
is in your shell search path.
To run your script from the Finder you have two options:
Drag it to PythonLauncher
Select PythonLauncher as the default application to open yourscript (or any .py script) through the finder Info window and double-click it.PythonLauncher has various preferences to control how your script islaunched. Option-dragging allows you to change these for one invocation, or useits Preferences menu to change things globally.
4.1.2. Running scripts with a GUI¶
With older versions of Python, there is one Mac OS X quirk that you need to beaware of: programs that talk to the Aqua window manager (in other words,anything that has a GUI) need to be run in a special way. Use pythonwinstead of python to start such scripts.
With Python 3.9, you can use either python or pythonw.
4.1.3. Configuration¶
Python on OS X honors all standard Unix environment variables such asPYTHONPATH
, but setting these variables for programs started from theFinder is non-standard as the Finder does not read your .profile
or.cshrc
at startup. You need to create a file~/.MacOSX/environment.plist
. See Apple’s Technical Document QA1067 fordetails.
For more information on installation Python packages in MacPython, see sectionInstalling Additional Python Packages.
4.2. The IDE¶
MacPython ships with the standard IDLE development environment. A goodintroduction to using IDLE can be found athttp://www.hashcollision.org/hkn/python/idle_intro/index.html.
4.3. Installing Additional Python Packages¶
There are several methods to install additional Python packages:
Packages can be installed via the standard Python distutils mode (
pythonsetup.pyinstall
).Many packages can also be installed via the setuptools extensionor pip wrapper, see https://pip.pypa.io/.
4.4. GUI Programming on the Mac¶
There are several options for building GUI applications on the Mac with Python.
PyObjC is a Python binding to Apple’s Objective-C/Cocoa framework, which isthe foundation of most modern Mac development. Information on PyObjC isavailable from https://pypi.org/project/pyobjc/.
The standard Python GUI toolkit is tkinter
, based on the cross-platformTk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is bundled with OSX by Apple, and the latest version can be downloaded and installed fromhttps://www.activestate.com; it can also be built from source.
wxPython is another popular cross-platform GUI toolkit that runs natively onMac OS X. Packages and documentation are available from https://www.wxpython.org.
PyQt is another popular cross-platform GUI toolkit that runs natively on MacOS X. More information can be found athttps://riverbankcomputing.com/software/pyqt/intro.
4.5. Distributing Python Applications on the Mac¶
The standard tool for deploying standalone Python applications on the Mac ispy2app. More information on installing and using py2app can be foundat http://undefined.org/python/#py2app.
4.6. Other Resources¶
The MacPython mailing list is an excellent support resource for Python users anddevelopers on the Mac:
Another useful resource is the MacPython wiki:
I am trying to get a CLI command for 'revert to basis' of all the overlapping dll's in my workspace.
Which command should I use for this -
purge
orrevert
?I want to do this action only for overlapped dll files in my workspace. What is the best approach?
Purge
Get a list of all the overlap files. Run the command 'accurev stat -o -ffl > list.txt'
Then run the command 'accurev purge -l list.txt'
GO support for building CLI tools using native system shell [closed]
shell,go,command-line-interface
curl has an interesting implementation in Go with astaxie/bat Go implemented CLI cURL-like tool for humans. Bat can be used for testing, debugging, and generally interacting with HTTP servers. That means you needs to implement your REST server in order for any curl-like tool to interact with it. See for...
Building C# code in VSCode on Mac
c#,osx,xamarin,command-line-interface,vscode
You can setup a build task to compile the modified source. See https://code.visualstudio.com/Docs/tasks or http://blog.denouter.net/2015/04/compile-visual-studio-solution-in.html
How to get the changes from other person's workspace in Accurev?
You can do this a few ways. By file: For each file you want, in your workspace, select the file -> open the 'version browser' -> select the version of the file from the other workspace -> right click -> You can either 'Send to Workspace', Patch or Merge. By...
Making a neat, installable Python library with Click
python,click,command-line-interface,setuptools
If you've followed the Setuptools Integration steps in the article you linked to, you're most of the way there. Try installing the package as if it came from pip (maybe in a different virtualenv): $ virtualenv deploy $ source deploy/bin/activate $ pip install . Then you can invoke your command...
how to use .include? in Ruby with a hash statement
ruby,command-line-interface
It looks like you're calling include? on a string. This will only return true if you pass it a substring of itself. For example: 'Mario'.include?('Mar') #=> true You want to call include? on the array of keys in the name hash. You could do: name.values.include?(character) or more concisely name.has_value?(character) Here's...
Create a Black Jack game with a command line Interface
java,command-line-interface,blackjack
I think the meaning of 'command line interface' here is a mixture of command line arguments and reading from System.in and writing to System.out. ie the user can interface with the program through a command line terminal or window. Furthermore it probably implies that the user issues commands through that...
Java program with referenced libraries: NoClassDefFound [duplicate]
java,jar,terminal,classpath,command-line-interface
you need to tell JVM where to look for classes while running the program. the parameter that we use to tell jvm that is known as classpath there are different ways to achieve that Recomended Add the classpath location to the run command , alternatively pass the jar locations, assuming...
How can I pass the result of a command to another command in one line?
bash,shell,command-line,concatenation,command-line-interface
Assuming that the number of minutes should be an integer rather than a string: my_cli --json '{'minutes' : '$(( ( ( $(date +%s) - 18000 ) % 86400 ) / 60 ))' }' ...
cURL live output CLI
curl,output,command-line-interface
Perhaps curl's -N / --no-buffer option will help you?
Remove e-mail string from the beginning of each row in a file
linux,shell,command-line-interface,cut
You can use sed: sed 's/^[^[:blank:]@][email protected][^[:blank:]]+[[:blank:]]*//' file > file.out some string with no set width another string yet another string!! shortstring gnu sed will work with this: sed 's/^[^[email protected]][email protected]S+s*//' file > file.out ...
Start a process in background, do a task, then kill the process in the background
bash,command-line-interface
When the script is excecuted a new shell instance is created. Which means that the jobs in the new script would not list any jobs running in the parent shell. Since the selenium-server server is the only background process that is created in the new script it can be killed...
Export database from a remote server into a specific folder on my computer
php,mysql,database,shell,command-line-interface
You can run mysqldump -h yourhostname -u youruser -p yourdatabasename > C:yourfilepath.sql -h connects you to the remote servers IP so you can dump the data locally, as long as your user has the correct privileges and you can connect remotely to your database server. However, you may need to...
Script to copy and rename file fails on Mac OS X
osx,bash,command-line-interface,provisioning-profile
When using the cp command in Bash you need to provide the full path of the files. Aliases such as ~/myFolder won't work. You will need to provide a full path such as /Uers/Me/myFolder.
cordova run android executes fine. But Android 4.1.2 doesn't start the app
android,cordova,android-emulator,command-line-interface
I met the same problem (Cordova 'hello world' app won't display) and found a way to pass through it (but I don't really understand the underlying causes). Problem seemed to occur when installing the apk. On Cordova 5.0.0, adb commands to install the apk can be found at line 101...
Shell function command with quotes
bash,shell,command-line-interface,zsh
You want '$*' not '[email protected]' because you want the arguments expanded as a single word not multiple words. This is one of the few times the '$*' expansion is actually desirable. It generally isn't....
Git for Windows equivalent for open current directory command
git,shell,command-line-interface,git-bash
Lets say I have a file called index.html and from the command line I want to use a command that would pull up this file up in sublime text which is my default text editor. How would I do that? Simply define an alias (if you are in a...
argparse optional value for argument
python,python-3.x,command-line-interface,argparse
You can do this with nargs='?': One argument will be consumed from the command line if possible, and produced as a single item. If no command-line argument is present, the value from default will be produced. Note that for optional arguments, there is an additional case - the option string...
How -s option works actually in gcc compilers?
gcc,g++,command-line-interface
On Linux systems, gcc -s probably invokes the strip(1) utility (which remove most symbols from ELF files) from binutils. You could check by running gcc -v -s. To lower the executable size, you should also compile with -Os (in addition of -s) which asks the compiler to optimize for size....
amazon EC2 command line interface not returning all my snapshots
amazon-web-services,amazon-ec2,command-line-interface
Here's an alternative, using the AWS Tools for PowerShell. This utility should already be installed if your Windows EC2 is based off of an AMI that Amazon provided. This example describes a collection of snapshots that you created, and is filtered by status 'completed' and by your provided volumeId. It...
How to action a command from a PHP script in the current CLI context?
php,command-line-interface
The escape code ^[]50;ClearScrollback^G itself is described in Proprietary Escape Codes iTerm2 documentation. A quick comment on notation: in this document, ^[ means 'Escape' (hex code 0x1b) and ^G means 'bel' (hex code 0x07). You can use PHP chr() function, e.g. php -r 'echo chr(27) . ']50;ClearScrollback' . chr(7);' The...
Execute code after script abort on CLI
php,command-line-interface
The function pcntl_signal() is the answer for the situation when the script is interrupted using Ctrl-C (and by other signals). You have to pay attention to the documentation. It says: You must use the declare() statement to specify the locations in your program where callbacks are allowed to occur for...
Adapt GO build into different OS
go,command-line-interface,cloudfoundry
Go can build from any OS to any OS. You control the OS and architecture with two environment variables, named GOOS and GOARCH. The former is the operating system, and the latter is the CPU architecture. Building for 64-bit Linux is set as: GOARCH=amd64 GOOS=linux The options for GOARCH are...
AWS CLI not working on Mac OSX Yosemite
python-2.7,amazon-web-services,pip,amazon,command-line-interface
/Library/Frameworks/Python.framework/Versions/2.7/bin will need to be in your path. In your ~/.profile file (create one if necessary) add a line like: export PATH='/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH' Open a new Terminal window and it should work....
Can't launch a program from a different directory via Pexpect
python,bash,command-line-interface,pexpect
To run an executable hw, either its parent directory should be in PATH envvar or you should provide the full path. If the path is relative (not recommended) then it is a path relative to your current working directory regardless of cwd value. If you want to run hw from...
How to display progress of another command
bash,shell,command-line-interface
What you want to do is run do_something > file.txt in the background and then monitor it. You can use the special kill signal 0 to do this. do_something > file.txt & PID=$! while kill -0 $PID 2> /dev/null do [calculate percent complete] [display percent complete] sleep 5 done ...
npm bin property is not working as expected
node.js,npm,command-line-interface
I solved the problem by adding the following line to the top of the addHeaderCli.js: #! /usr/bin/env node Now I can cal it like: addheader 'test.txt' 'my header' ...
Batch file get present working directory after cd command
windows,batch-file,cmd,command-line-interface,current-dir
Accurev Command Line Tutorial For Mac Windows 10
If your Batch file does something like this: @echo off echo Start at: %cd% cd sub cd sub2 echo Currently at: %cd% The second echo command will show C:somedirsubsub2 for sure. However, if the %cd% is placed in a code block, that is, enclosed in parentheses (like inside an if...
Reading lines from .txt into batch file and handing into command line as arguments?
python,batch-file,command-line-interface,command-line-arguments
for /f 'usebackq tokens=* delims=' %%# in ('C:pathtodocument.txt') do ( call 'C:/path/to/script.js' %%# ) ?...
Google Cloud SQL - ERROR 2003 (HY000): Can't connect to MySQL
mysql,google-app-engine,command-line-interface,ip-address,google-cloud-sql
So for whatever reason, I was able to connect if I requested an IPv4 address (costs $0.01 an hour) and used that to connect instead of the free IPv6 address, then I could connect from anywhere. Otherwise I can only connect to my Cloud SQL when it is using the...
How can I save a user specifig config in a node module?
javascript,node.js,command-line-interface,config
You can write to a hidden file in, say, ~/.mycliconfig and the just read the file synchronously try{ var userData = fs.readFileSync(process.env.HOME + '/.mycliconfig'); } catch(e){ if (e.code 'ENOENT') { console.log('File not found!'); } else { throw e; } } If you need to save more stuff you can...
how does apache commons-cli parses t character
shell,command-line,command-line-interface,backslash,apache-commons-cli
As you are trying to provide this when invoking the application in the shell, this is actually related to how the shell handles such special characters, not commons-cli or Java. The bash shell (which is the default shell on most unix/linux versions nowadays) has the special syntax $'t' for this,...
How do I create a node.js command line utility that uses gulp
node.js,command-line-interface,gulp
Gulpfiles are just node apps. You can require them in your node app like any module: var gulpfile = require('./gulpfile.js'); Then you can invoke a gulp task that was defined in the gulpfile: gulp.start('someTask'); Note that .start() will be deprecated in gulp 4.0 Putting that all together, it would look...
C# - Converting String array to sbyte** (String[] to sbyte**)
c#,arrays,pointers,clr,command-line-interface
it solved by: sbyte[][] sbytes = new sbyte[6][]; for (int argCounter = 0; argCounter < 6 ; argCounter++) { get the byte array byte[] bytes = Encoding.ASCII.GetBytes(argument[argCounter]); convert it to sbyte array1 sbytes[argCounter] = new sbyte[bytes.Length]; for (int i = 0; i < bytes.Length; i++) sbytes[argCounter][i] = (sbyte)bytes[i]; } unsafe...
Stop Java Process if Running in Raspbian
java,command-line-interface,raspbian,application-shutdown
If you prefer a one-liner JPID=$(jps -m | grep NameOfTheMainClass | awk '{print $1}') && [ -z '$JPID' ] || kill $JPID ...
c++ 2 ref classes should have acess to one same object of a other class
c++,windows,reference,system,command-line-interface
If your class of c is a ref class, you can use ^ (handle) to reference it. like the code here ref_class_c ^ d(gcnew ref_class_c); ref_class ^ e = d; As for the tracking reference versus a handle, the difference is similar to a reference/out parameter in C# method versus...
What are the different ways of submitting Hadoop jobs?
command-line-interface,oozie,hadoop2
What does Hadoop jobs mean ? MapReduce : CLI + Oozie Spark : spark-shell + Java / Pyton / Scala + Spark Job Server (Rest) + Oozie Hive : CLI + Java - Thrift(JDBC) + Oozie Pig : CLI + Java + Oozie etc ....... If you want to use...
Debugging Node.JS CLI application with VSCode?
node.js,debugging,command-line-interface,xubuntu,vscode
On Linux Visual Studio Code does not yet open a terminal for the program to be debugged, so there is no way to interact with it through the command line. As a workaround you can launch the node program from a terminal in debug mode and attach to it from...
Weird behaviour of cURL request in PHP script
php,apache,curl,browser,command-line-interface
Have you tried logging verbose output for the Curl request? Normally I find this the best way to figure out what's going on under the hood...http://stackoverflow.com/a/14436877/682754 Also not as popular but this approach looks simple to implement and is a lot cleaner...http://stackoverflow.com/a/26611776/682754...
How to use the --verbose flag in the MySQL 5.6 command line client?
mysql,command-line-interface
The correct syntax for a verbose interactive session is: c:> mysql -u yourUser -p -v yourDatabase This will launch an interactive session (prompting you for password), and set yourDatabase as the default database for the session. Once in this interactive session, issue a tee command: mysql> tee c:/temp/my.out And now...
How can I read iso-8859-1 file
linux,centos,command-line-interface
The file is not ISO-8859-1. That would be Western Europe. Instead, it looks like one of the Cyrillic flavors (for example ISO-8859-5). Here is a screenshot showing the file before converting it: You would probably not like the result transliterated into ASCII. I recommend converting it to UTF-8, e.g., iconv...
How can I run grunt as a daemon?
node.js,gruntjs,command-line-interface,daemon,epub
Here's the solution I found: As was suggested above, using pm2 However, when I ran pm2 start grunt I got an error saying that the grunt module did not exist, which was weird. So I ended up writing a script which worked: -- start.js -- var pm2 = require('pm2'); pm2.connect(function()...
CF CLI features that are enabled in Bluemix
command-line-interface,bluemix
Unfortunately it is not documented which features of the Cloud Foundry CLI are implemented in Bluemix and which ones are not - other than what is documented here. Some features, such as deleting organizations, can affect multiple things such as billing so that has to be done through support tickets....
Terminating python for loop program in the command line without closing it?
python,command-line-interface
Generally I find that Ctrl+c does the job. It's a keyboard interrupt that should halt most python activity in the interpreter/terminal on both windows and linux
Spring Shell - usage and execution
java,spring,spring-boot,command-line-interface,spring-shell
That comment in the documentation is a bit misleading (I'll change it). For your components to be picked up, they need to be on the classpath AND you'll need to scan for them somehow. See for example how in the Spring XD project, there is a scan for the org.springframework.xd.shell...
Install role services using command line
powershell,command-line-interface,windows-server-2012
Install-WindowsFeature –Name feature_name -ComputerName computer_name -Restart
Asterisk CLI - reset scrollback
Accurev Command Line Tutorial For Mac Os
command-line-interface,asterisk,elastix
No, not possible. But you can write your own tool and change behavour whatever you need. For call-specific info you can check CEL or CDR....
Commons CLI is not honoring my command line setup
java,command-line-interface,apache-commons-cli
First the .hasArg() on your OptionBuilder tells it that you expect an argument after the paramter flag. I got it to work with this command line --fizz 'VicFizz is good for you' -b 'VicBuzz is also good for you' Using the following code - I put this in the constructor...
How to pass a hash as optional argument to -M in command line
perl,hash,package,command-line-interface
Looking at perlrun use: perl -Mfeature=say '-Mconstant {c1 => 'foo', c2 => 'bar'}' -e'say c1,c2' ...
Can't execute exec command (php / windows / ffmpeg)
php,windows,ffmpeg,exec,command-line-interface
Accurev Command Line Cheat Sheet
I had ffmpeg after ffmpeg.exe - that's why it didn't work. $cmd = 'C:wampwwwffmpegbinffmpeg.exe -i tmp1.flv -c:a copy -vf drawbox=:x=0:y=0:color=invert:t=2 output2.flv 2>&1'; exec($cmd, $output) ...
Accurev Command Line Tutorial For Macbook Pro
ZF Error ZF tool setup
zend-framework,command-line-interface
Accurev Command Line Tutorial For Mac Os
I ended up using Zend Framework 1 final release - version 1.12.11 to get around this headache and it worked perfectlt as it should have. Had to be a bug in the 1.9 version!