43MacintoshSetup/MacPorts version

How to setup your Macintosh for Macport
前園グループ/مجموعة مايزونو/กลุ่ม มาเอะโซโน/मेइजोनो समूह
Homebrew versionを用いてMacintoshを設定する方法は こちら

N.B.) Homebrew version is RECOMMENDED (on 22Apr2019).

00/Before upgrading/Caution on MacOS version upgrade…

Attention

Do not upgrade your MacOS unless we’ve confirmed that the following functionalities are surely working on the upgraded OS version

   OSX     10.9  10.10  10.11  10.12
*sshfs       OK    [1]    [1]    OK
*pTeX        OK     OK     OK    OK
*xmgrace     OK     OK     OK    OK
*gnuplot     OK     OK     OK    OK
*pukiwiki    OK     OK     OK    OK
*xcrysden    OK     OK     OK    OK
*XQuartz     OK     OK     OK    [2]
*MathType    OK     OK     OK    [3]
[1] It was no problem but some error recently confirmed on Yosemite Oct.15.
[2] There appears error message, but somehow works.
[3] Installer gets stuck during its installation, but somehow it works.
[4] only for Word2011 & MathType6.7h

01/Fundamentals (confirmed on Sierra, Dec2016) (Macports version)

011/Starting up

  • 0111/OS update

  • 0112/Setup your iCloud account

012/Dropbox Installation

Download the installation file from dropbox web page from here
and then execute this file
  • User Setting

    ID/PW ask to a staff

013/Terminal Setting

  • put its shortcut (alias) into the ‘Dock’

  • Terminal Preferences

    • ‘General’

      • set ‘New windows open with:’ to
        ‘Default profile’ and ‘Default Working Directory’
      • set ‘New tabs open with:’ to
        ‘Default profile’ and ‘Default Working Directory’
    • ‘Profile’

      • select ‘Pro’ and click ‘Default’
    • ‘Text’

      • change ‘Font’ to ‘Monaco 18 pt.’
        and then check ‘Blink cursor’.
      • カーソルも選択部分も赤色
    • ‘Window’

      • ‘Window Size,’ modify ‘Column’ to ‘100,’ and ‘Rows’ to ‘35’
    • ‘Shell’

      • ‘When the shell exits: Close the window’
      • check ‘Ask before closing:’ to ‘Never’
    • 選択部分は赤

014/Installation of Google-Japanese (This should be after all the dropbox sync has completed)

Download the installation file from the web page from here

  • Dropbox-nize your dictionary for Google-Japanese

% pwd
/Users/maezono/Library/Application Support/Google
% mv JapaneseInput/ JapaneseInput_bak
% ln -s ~/Dropbox/01backup/JapaneseInput .
  • N.B. To setup from scratch, first cp ‘JapaneseInput’ from the common dir. on Dropbox:

% cd ~/Dropbox/02Shared/07maezonoSettings/04commonSetup/07StandardDictionary/
% cp -r JapaneseInput ~/Dropbox/01backup/

015/Safari Environmental Setting

  • Go to Safari > Preference > General
    and uncheck ‘Open “safe” file after downloading…’
    (If you don’t do this setting, an inconvenient problem will occur
    because ‘xxx.zip’ file will unzip (self-extracting) automatically
    when we download ‘xxx.zip’ file, such as the ACS format files.
    By removing the check from default, then it will not be self-extracting.)
  • 表示>お気に入りバーを表示

016/System Preferences Setting

  • Dock

    • change ‘Position on screen’ to ‘Left’

    • check the following options:
      ‘Automatically hide and show the dock’
  • Security & Privacy

    • go to ‘Genral,’ click on the ‘Lock’ icon to activate the options
      check ‘Allow apps downloaded from’ to ‘Anywhere’
      You cannot find this item in OS sierra, but you can do equivalent operations by this command:
sudo spctl --master-disable
  • Mission Control

    Mission Control: F9
    Application windows: F10
    Show Desktop: F11
    Show Dashboard: F12
  • Hot Corners

    • Upper Right: Mission Control

  • Keyboard

    • modify the ‘Key Repeat’ to ‘Fast’ and ‘Delay Until Repeat’ to ‘Short’

    • check ‘Show Keyboard & Character …”

    • check ‘Use function keys…’

    • go to ‘Shortcuts/Spotlight,’ then uncheck both of those available options

    • go to ‘Shortcuts/Input sources’ then click the string at the right of
      ‘select previous input source’ and type command + space.
      (If system language is English, first add Japanese to Input sources,
      otherwise ‘Shortcuts/Input sources’ doesn’t appear)
    • go to ‘Input source’ then check both of those available options

    • ‘Input Sources,’ only use ‘ひらがな(Google),’ ‘U.S.,’ and your own language

  • Accessibility

    • go to ‘Display,’ then modify ‘Cursor size’ to more than toward ‘Large’

  • Mouse

    • Point & Click

      • uncheck ‘Scroll direction: natural’

      • modify ‘Tracking speed,’ to the third speed from the right.

  • Trackpad

    • Point & Click

      • check ‘Tap to click’,

      • modify ‘Tracking speed’ to the third speed from the right.

  • Scroll & Zoom

    • uncheck ‘Scroll direction: natural’

  • Sharing/共有

    • under ‘Computer Name(コンピュータ名)’, set ‘meiwaku19pc01’ (for example).

    • check the following options

      • ‘Screen Sharing’

      • ‘File Sharing’

      • ‘Remote Login’

017/Finder Option

  • ‘Finder/Preferences/General’

    • under ‘Show these items on the desktop:’ check all available options.

    • under ‘New Finder windows show:’ select ‘Desktop’

  • ‘Sidebar’

    • check ‘maezono’

  • ‘Advanced’

    • change ‘Search This Mac’ to ‘Search the Current Folder’

    • check ‘Display extensions’

02/Settings via commands (confirmed on Sierra, Dec2016).

021/First command operations

  • Visualization of Library

    • by typing this command in the terminal:

chflags nohidden ~/Library/
If this doesn’t work, go to ‘home(maezono) on Finder’, and press ⌘+J
check “Show Library Folder”

022/Getting and Setting ‘.bash_profile/.bashrc/.alias’

% pwd
    /Users/maezono
% cat .bash_profile
   source ~/.bashrc
% cat .bashrc
   source ~/Dropbox/01backup/bin/bash_alias_private
   source ~/Dropbox/02Shared/07MaezonoSettings/04commonSetup/01bin/bash_alias_common

023/Xcode

  • Free installation from Mac App Store.
    Open ‘App Store,’ then search for ‘Xcode,’ and then click ‘get’
  • ‘Command Line Tools’ installation
  • Xcode > Preferences > Download Command Line Tools
    open ‘Terminal,’ and type this command:
% xcode-select --install
follow the instruction in the pop-up window, then you can install the ‘Command Line Tools’.
After that, type the following command in the terminal:
% sudo xcodebuild -license

then type ‘agree’

  1. macport

% sudo port sync
% sudo port selfupdate
to learn more how to use macport, reference is made in this site:
  1. wget

% sudo port install wget
  1. Install XQuartz

After this installation, reboot your Mac once.
  1. Install emacs

http://emacsformacosx.com/

  1. sshfs

% sudo port install sshfs

to create mount point, please make directory

% mkdir -p ~/sshfs/unified
we can mount our ‘XXX’ server to the above directory by using ‘yamaXXX’ in .alias
after this server is mounted, we can use GUI in our mac to connect to the server.
If your installation failed in macOS High Sierra (10.13) or Mojave (10.14),
use either of these workarounds:

High Sierra (10.13)

% cd /Applications/Xcode.app/Contents/Developer/Toolchains
% sudo ln -s XcodeDefault.xctoolchain OSX10.13.xctoolchain

Mojave (10.14)

% sudo mkdir /usr/local/lib
% sudo ln -s "$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib" /usr/local/lib

reference page (both): https://trac.macports.org/ticket/54939

Or we can download software for osxfuse and sshfs from below website.
after downloading it, you need to install osxfuse first.
After that you install sshfs.
Note that by this way, sshfs and osxfuse are not managed by macports,
so you have to update them separately periodically.
  1. GNUPLOT

  • 141/gnuplot Installation

% sudo port install gnuplot
  • 142/gnuplot Setting

gnuplot will be opened with ‘aqua’ but not the ‘X11’
it is better to use ‘X11’ intead of ‘aqua’
however, the default setting is ‘aqua’ so we need to set ‘X11’ as our default setting.
in order to set ‘X11’ as default, edit the file: ~/.gnuplot
then please type: “set term x11” as shown in the example below:
% cd /Users/maezono
% echo "set term x11" > .gnuplot
% cat .gnuplot
  set term x11
  1. xmgrace

% sudo port install xorg-libXt +flat_namespace
% sudo port install grace

Test if it works:

% cp ~/Dropbox/02Shared/07maezonoSettings/04commonSetup/dmc.hist .
% xmgrace dmc.hist
  1. openmpi Installation (based on gcc6)
    In order to install openmpi, please use the MacPort (as of 09Mar16):
% sudo port install gcc6
% sudo port select --set gcc mp-gcc6
% sudo port install openmpi-gcc6
% sudo port select --set mpi openmpi-gcc6-fortran

If the installation failed, you may try these steps:

  • download fixed syslog.h file from here (or modify it by yourself, see diff)
  • enter recovery mode by pressing ⌘+R while rebooting
  • open terminal, find the the label of and mount “Macintosh HD”/”MACOSX/名称未設定” (may has different names according to your language setting)
% diskutil list
% diskutil apfs unlockVolume [Macintosh HD"/"MACOSX/名称未設定]
  • backup and replace original syslog.h

% cd [Macintosh HD"/"MACOSX/名称未設定]/usr/include/sys/
% mv syslog.h syslog.h.bak
% cp [downloaded syslog.h] syslog.h
  • reboot, and then before continuing installation, clean the previous build of openmpi

% sudo port clean openmpi-gcc6
% sudo port install openmpi-gcc6

reference page: https://trac.macports.org/ticket/54993

  1. xcrysden & openbabel
    can be installed by using command:
% sudo port install openbabel
% sudo port install py-openbabel
% sudo port install xcrysden

Environmental setups are:

% mkdir ~/.xcrysden
% echo 'set xcMisc(babel) /opt/local/bin/babel' > ~/.xcrysden/custom-definitions
% export XCRYSDEN_TOPDIR=/opt/local/share/xcrysden-1.5.60/

Then test it:

% /opt/local/share/xcrysden-1.5.60/tests/run_test.sh structures
  1. Resuming of wdworker

% sudo mdutil -a -i on
  1. unrar Installation

% sudo port install unrar
  1. nkf Installation

% sudo port install nkf
  1. MATLAB installation(If you need.)
    Install MATLAB following this webpage
  2. python2.7 environment

%  sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose

and include the below statement to your alias

export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

To avoid making .DS_Store

  • below is the reference web page but in Japanese
  • execute this command in Terminal:
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
  • how to delete existing ‘.DS_store’
    find Desktop/target directory -name “.DS_Store” -print -exec rm {} “;”
    Restart Finder
    killall Finder

03/Fundamental Softwares(confirmed on Sierra, Dec2016)

031/Install and setup ’mi’ editor.

version 3.x

  • Transfer the environment setup files
    to your ~/Library/Application Support/mi3/mode/
    from 01commonSetup
cp -r Dropbox/02Shared/07maezonosettings/04commonSetup/05mi/mi3/mode ~/Library/Application\ Support/mi3/

Go to mi > Application Preferences… > Print

  • under ‘Print’ tab
    Check ‘Use Font for Print Instead of Font foe Display’.
    Change ‘Font’ to ‘Monaco 9.0 pt.’

(2019/04/11現在、上記の方法で設定すると、インデントがdeleteで一括で消えてしまう。これを避けるには「mi > モードの毎設定 > 標準 > インデント > インデントのオプション」 の「前一文字削除時の左シフト:行頭で前一文字削除したときは左シフトする」をアンチェックする。この設定をmodeファイルに書けるのかは不明。)

  • Or equivalently, setup your environment
    go to mi > Mode Preferences… > Normal
    • under ‘General’ tab
      Font: ‘Monaco, 18 pt’.
    • under ‘Edit’ tab
      Wrap mode: ‘Word Wrap with Window Width’
      Spell check: ‘Highlight misspelled word with red underline’
    • under ‘Display’ tab
      Control code display: check all
    • under ‘Indent’ tab
      Indent character: ‘Space characters, 4 characters’
    • under ‘Key Bind’ tab
      There is the ‘import’ button, from which you can import your preset.~

version 2.x

Go to mi > Setting mode > Save
and uncheck all of those available options in Information Setting Documents
  • Transfer the environment setup files
    to your ~/Library/Application Support/mi/mode/
    from 01commonSetup
cp -r Dropbox/02Shared/01Maezono_Group01/04commonSetup/05mi/mi2/mode ~/Library/Application\ Support/mi/
  • Or equivalently, setup your environment

    • go to Mode Preference > Default
      change ‘Font: (Default Font)’ and ‘Size: 18 pt’.
      Wrap with Window Width.
    • go to ‘Display’ tab
      Under ‘Display Code Characters:’ check all of available code options
    • go to ‘Edit’ tab, and check ‘Input Space Character instead of Tab …’
    • go to ‘Edit’ tab, and check ‘Display Red Underline at Misspelled Word’
  • Keyboard short cuts.
    From ‘Mode setting’ found as a button, you’ll find ‘key-bind’.
    There is the ‘import’ button, from which you can import your preset.

033/Skype Installation

Download the installation file from Skype web page , and then execute this file.

034/Microsoft Office Installation

  • Setting
    Override your ‘Normal.dotm’ by that located in the common folder:

(office365)

cp ~/Dropbox/02Shared/07maezonoSettings/04commonSetup/04Office/office356/Normal.dotm ~/Library/Group\ Containers/UBF8T346G9.Office/User\ Content.localized/Templates.localized/Normal.dotm
  • Be sure whether the following ‘system shortcuts’ are deactivated.
    These can be deactivated from ‘System Preferences->Keyboard->Shortcuts->Services’ as,
    • Searching->Search With Google (Shift+Command+L)

    • Text->Complete Citation (Shift+Command+J)

    • Text->Complete Cite Key (Shift+Command+K)

  • See if the following shortcuts work (All usage for shortcuts are found by typing ‘shortcuts’ from terminal).

    • Enter Normal: Osaka 5 Line spacing: single

    • Shift+Command+h 正文: Osaka 12 Left: 0.35 cm

    • Shift+Command+j 第一見出し: MS Gothic 20 Left: 0.35 cm

    • Shift+Command+k 第二見出し: MS Gothic 18 Left: 0.35 cm

    • Shift+Command+l 第三見出し: MS Gothic 14 Left: 0.35 cm

    • Shift+Command+n 数式等numerical: Monaco 10 Left: 3.53 cm

    • Shift+command+z 図番: Osaka 10 Centered

  • Note that these settings sometimes will not apply on previously created documents.
    In such case, copy styles from the Normal.dotm using Tools -> Templates and Add-ins -> Organizer menu.

035/MathType

036/Sketchy Draw

can be installed from the Mac App Store.

04/Establishing Environments

041/Registration of Digital Certification

  • Get your digital certificate.

  • Put/keep the certificate on your Dropbox using such a name ‘NIICertificateTil18May.p12’.

  • Click the certificate. By answering PW asked, then it will be kept in your key-chain. For more details, vist the following site (see “Others manuals” and select your appropriate browser):
  • Try connecting JAIST(eduroam) wifi to see if it works. For more details, visit the following web site (“Settings for Wi-Fi connection in JAIST”):
    N.B. “eduroam” is available at many world-wide academic institutes and then recommended to be setup.

0411/Import to your iPhone

  • Send your digital certification to your iCloud email address

  • Tap the certification on the email, then “Profile” will appear.

  • Follow its instruction, e.g. enter your password, etc.

042/ssh Key Generation and Key Authentication

  • in Terminal, please type ‘ssh-keygen’
    then you can get the public key in the ‘.ssh’ directory
    you will be prompted to the passphrase,
    but you have to skip this by pressing ‘return’ (enter) key
  • register ‘.ssh/id_rsa.pub’ to ‘.ssh/authorized_keys’ in each server
    for example, unified server, supercomputer, or youmono server

043/Sharing Desktop with your subPC

From mainPC,

%cd
%sudo mv Desktop Dropbox/
% ln -s Dropbox/Desktop ~/

From SubPC, after moving all the contents on the Desktop onto Dropbox/Desktop, then

%sudo rm -r ~/Desktop
% ln -s Dropbox/Desktop ~/

044/CASINO (confirmed on Sierra, Dec2016)

0441/gfortran Installation

% which gfortran
/opt/local/bin/gfortran

N.B. If your gcc6 is correctly installed using port, you can see the above. Otherwise, go back to the gcc6 installation shown above (as of 09Mar16).

0442/CASINO Installation

  • make applications directory in home directory

% cd
% pwd
 /Users/maezono
% mkdir applications/

If you fail to install casino, use fortran-mp-4.9, which is installed by macport

  • unzip CASINO file in the applications directory

% pwd
/Users/maezono/applications
% cp /Users/maezono/Dropbox/02Shared/07maezonoSettings/04commonSetup/v213pl713_noex.tar.gz .
% tar -xzvf v213pl713_noex.tar.gz
% l
v213pl713/          v213pl713_noex.tar.gz
  • set arch file in .alias is specified below:

export QMC_ARCH=intelmac-gcc
export CASINO_ARCH=intelmac-gcc
% fixal
  • Installing CASINO

% pwd
 /Users/maezono/applications/v213pl713
% rm -rf bin_qmc/
% make -j 4
  • Create link as ‘currentCASINO’

% cd
% l
Desktop/ Downloads/ ...
% ln -s applications/v213pl713 currentCASINO
% l
Desktop/ Downloads/ ...  currentCASINO@ ...
  • Set the path

% setal
PATH="$PATH":$HOME/currentCASINO/bin_qmc/utils/intelmac-gcc/
% fixal
# Check the operation of utility, for example, reblock, graphit, etc.
% pwd
/Users/maezono/Downloads
% l
... dmc.hist ...
% reblock
% graphit

045/Scanner&NameCardAdmin

  • Prepare the environment so that you can connect your PC with ScanSnap.

  • Goto the directory
    /Users/maezono/Dropbox/02Shared/01Maezono_Group01/04commonSetup/09otherUtilities/scansnap
    Execute installation from 01…, 02…
  • Confirm if your NameCard DB is correctly reproduced.

046/VMware Horizon Client for Mac

047/Mail

Account admin.

Create icloud account.
Do not separately use gmail/icloud/yourInstitutes accounts.
Take your responsibility on each account.
Use ‘forward’ function from each accounts to an icloud account
so that you could prevent from ignoring important contacts.

Archiving email communications

For research activities, all of email communications
forms a significant fraction of the important research log.
Treat them carefully with safely archiving, do not get them lost.

Do not accumulate all in icloud server

Only the latest two-three years emails can be
stacked in icloud server, but older ones should be
moved to your Dropbox account with backup.
Then remove older emails from icloud servers.
Do not leave your icloud being ‘nasty stack’.

Restore all the older emails in PC

There is a procedure how to restore the older
emails on Dropbox into your newly purchased PC.
Make your PC always possible to trace back to
any of older communications.
environment setting > display tab > choose use classic layout
display>display items >"attached file, receiving time, sender,mailbox,destination"
display> uncheck "gathering per thread"

05/TeX stuff (confirmed on Sierra, June2017)

051/TeXLive Installation

% sudo port install texlive +full

N.B. RevTeX and ACS style are automatically installed via the above TeXLive installation. Don’t worry. (as of June/26/2017 by KH)

  1. aspell (Spell Checker)

% sudo port install aspell aspell-dict-en
  1. Setting for TeX_via_Emacs

% cd
% sudo ln -s ~/Dropbox/02Shared/07maezonoSettings/dotEmacs/init.el .emacs
% sudo ln -s ~/Dropbox/02Shared/07maezonoSettings/dotEmacs/.aspell.en.pws .aspell.en.pws
% sudo ln -s ~/Dropbox/02Shared/07maezonoSettings/dotEmacs/dot_aspell.conf .aspell.conf
% sudo ln -s ~/Dropbox/02Shared/07maezonoSettings/dotEmacs/dot_template .template
  1. How to typeset
    When you typeset ‘filename.tex’, the corresponding command is
% texcompile.sh filename
Test files are located at
/Users/maezono/Dropbox/02shared/01Maezono_Group01/04commonSetup/03tex/01texTest
where,
% cat texcompile.sh
 #!/bin/sh
 target=$1
 PATH=/opt/local/bin/:$PATH
 platex --kanji=sjis $target
 pbibtex --kanji=sjis $target
 platex --kanji=sjis $target
 pbibtex --kanji=sjis $target
 platex --kanji=sjis $target
 dvipdfmx $target.dvi
 open $target.pdf