User Tools

Site Tools


tech:macos:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tech:macos:start [2019/05/10 07:05]
rk4n3 created
tech:macos:start [2019/11/09 11:13] (current)
rk4n3
Line 1: Line 1:
 <typo fs:​xx-large;​ fw:​bold>​MacOS</​typo>​ <typo fs:​xx-large;​ fw:​bold>​MacOS</​typo>​
 +=== Homebrew ===
 +[[https://​brew.sh]]
  
- ​[[https://​github.com/​AdoptOpenJDK/​homebrew-openjdk]] where you can go and grab prebuilt openjdk binaries for macOS! \\+====== Development on MacOS ====== 
 +===== C/C++ ===== 
 +Using ''​Homebrew'':​ 
 +<​code>​ 
 +export HOMEBREW_NO_ANALYTICS=1 
 +brew update 
 +brew upgrade 
 +brew info gcc 
 +brew install gcc 
 +brew cleanup 
 +</​code>​ 
 + 
 +Alternative:​ go to the Apple App Store and install ''​Xcode''​ //​(Apple'​s compiler and development tools)//. \\ 
 +Then, in a terminal: 
 +<​code>​xcode-select --install</​code>​ 
 + 
 +<​code>​clang -o program program.c</​code>​ 
 +<​code>​clang++ -o program program.cc</​code>​ 
 +<​code>​g++ -std=c++11 -o program program.cpp 
 +g++-7 -std=c++11 -o program program.cpp</​code>​ 
 + 
 + 
 +<​code>​ 
 +brew install pkg-config 
 +brew install gettext 
 +brew install glib 
 +export PKG_CONFIG_PATH=/​usr/​local/​lib/​pkgconfig:/​usr/​X11/​lib/​pkgconfig 
 +</​code>​ 
 + 
 +<​code>​ 
 +==> Caveats 
 +==> libffi 
 +libffi is keg-only, which means it was not symlinked into /​usr/​local,​ 
 +because some formulae require a newer version of libffi. 
 + 
 +For compilers to find libffi you may need to set: 
 +  export LDFLAGS="​-L/​usr/​local/​opt/​libffi/​lib"​ 
 + 
 +For pkg-config to find libffi you may need to set: 
 +  export PKG_CONFIG_PATH="/​usr/​local/​opt/​libffi/​lib/​pkgconfig"​ 
 +</​code>​ 
 + 
 + 
 +=== Portable alternative for getting current time === 
 +<​code>​ 
 +#include <​time.h>​ 
 +#include <​sys/​time.h>​ 
 +#ifdef __MACH__ 
 +#include <​mach/​clock.h>​ 
 +#include <​mach/​mach.h>​ 
 +#endif 
 + 
 +struct timespec ts; 
 + 
 +#ifdef __MACH__ // OS X does not have clock_gettime,​ use clock_get_time 
 +clock_serv_t cclock; 
 +mach_timespec_t mts; 
 +host_get_clock_service(mach_host_self(),​ CALENDAR_CLOCK,​ &​cclock);​ 
 +clock_get_time(cclock,​ &​mts);​ 
 +mach_port_deallocate(mach_task_self(),​ cclock); 
 +ts.tv_sec = mts.tv_sec;​ 
 +ts.tv_nsec = mts.tv_nsec;​ 
 + 
 +#else 
 +clock_gettime(CLOCK_REALTIME,​ &ts); 
 +#endif 
 +</​code>​ 
 + 
 + 
 +===== Java ===== 
 +See [[https://​github.com/​AdoptOpenJDK/​homebrew-openjdk]] where you can go and grab prebuilt openjdk binaries for macOS! \\
  
 It’s just a case of using: \\ It’s just a case of using: \\
 <​code>​ <​code>​
 brew tap AdoptOpenJDK/​openjdk brew tap AdoptOpenJDK/​openjdk
-brew install <​version>​+brew cask install <​version>​
 </​code>​ </​code>​
 Where version is: Where version is:
-  * ''​adoptopenjdk-openjdk8''​ +  * ''​adoptopenjdk8''​ 
-  * ''​adoptopenjdk-openjdk9''​ +  * ''​adoptopenjdk9''​ 
-  * ''​adoptopenjdk-openjdk10''​+  * ''​adoptopenjdk10''​ 
 + 
 + 
 +===== JMeter ===== 
 +Install with: <​code>​brew install jmeter</​code>​ 
 +JMeter’s configuration files are located in the following directories:​ 
 +^Item ^Standard ​ ^ ^ 
 +|Plugins folder |JMETER_HOME/​lib/​ext ​ |Library folder for plugin dependencies |  
 +|Configuration folder |JMETER_HOME/​bin ​ | | 
 + 
 +^Item ^Homebrew ^ ^ 
 +|Plugins folder |CELLAR_HOME/​jmeter/​3.1/​libexec/​lib/​ext ​ |Library folder for plugin dependencies | 
 +| |CELLAR_HOME/​jmeter/​3.1/​libexec/​lib | | 
 +|Configuration folder |CELLAR_HOME/​jmeter/​3.1/​libexec/​bin | | 
 +With the following constants: \\ 
 +''​JMETER_HOME'':​ JMeter’s home, usually like ''/​home/​ubuntu/​jmeter-5.x'' ​\\ 
 +''​CELLAR_HOME'':​ should be ''/​usr/​local/​Cellar''​ 
 + 
 +===== Locust ===== 
 +  * ''​curl -O https://​bootstrap.pypa.io/​git-pip.py''​ 
 +  * ''​chmod 755 get-pip.py''​ 
 +  * ''​sudo -H ./​get-pip.py''​ 
 +  * ''​sudo -H pip install --ignore-installed six''​ 
 +  * ''​sudo -H pip install locustio''​ 
 + 
 +====== Trivia ====== 
 + 
 +===== CLI Tips + Tricks ===== 
 + 
 +==== Pretty-Printing ==== 
 +=== Pretty-Print JSON from a file ... === 
 +<​code>​cat unformatted.json | python -m json.tool</​code>​ 
 +=== Pretty-Print JSON from the clipboard ... === 
 +<​code>​pbpaste | python -m json.tool</​code>​ 
 +=== Pretty-Print XML from the clipboard ... === 
 +<​code>​pbpaste | xmllint --format -</​code>​ 
 + 
 +===== Desktop/GUI Tips + Tricks ===== 
 +==== Resize a window to 1920x1080 ==== 
 +Open ''​Applications''​ -> ''​Utilities''​ -> ''​Script Editor'',​ paste this, and hit the play button: 
 +<​code>​ 
 +tell application "​Firefox"​ 
 + activate 
 + set the bounds of the first window to {100,​100,​2020,​1180} 
 +end tell 
 +</​code>​
  
  
tech/macos/start.1557489918.txt.gz · Last modified: 2019/05/10 07:05 by rk4n3