---
# System prepended metadata

title: Environment setup for mac
tags: [Setup]

---

# Environment setup for mac

# General mac tips
* cmd + shift + G : to paste and directly go to the directory path
* cmd + shift + . : to see the hidden files
* reset SMC, PRAM/NVRAM only need for intel chip: [link](<https://eshop.macsales.com/blog/80731-how-to-reset-mac-nvram-smc-or-pram/>)  
PRAM/NVRAM: mac restart and press Opt + Cmd + P + R.   
SMC: turn off mac and press Shift + Ctrl + Opt + power button. 
* if it's Apple silicon chip, and the application must run on intel chip >> use [Rosetta](<https://support.apple.com/en-us/102527>)
* change default screenshot location(on desktop): run on terminal ```defaults write com.apple.screencapture location /Users/username/Pictures/screenshots ```

# Command line (CLI) on terminal
```zsh=
# search file name in file directory
[~] $ find ~/ -name "*.qcow2"
/Users/username//Library/Containers/com.utmapp.UTM/Data/Documents/Windows.utm/Data/A62EC3B1-2C39-42EE-AA05-68F6F1B62C67.qcow2

# check where the package located in your computer
[~] $ which python
/usr/bin/python


```

* ~/ = /Usersname/ # it's abbreviation for home directory 



# Xcode Command line Tools (CLT)

We don't need to install the full Xcode package, but we need Xcode Command Line Tools for software developing.

Some third-party software and libraries may depend on the (CLT) being installed, e.g. Homebrew, relies on it for building and installing certain packages.
* [install guide](<https://mac.install.guide/commandlinetools/>)
* [official link](<https://developer.apple.com/xcode/resources/>)
If specific version needed for older macOS, we cannot specify which version to install using the CLI, so go to the official and download .dmg. (need to login to Apple ID first to see the available downloads)
* check macOS versions - command line tools 
https://developer.apple.com/support/xcode/
![image](https://hackmd.io/_uploads/B1NSZwDaT.png)

```bash=
# if installing the lastes version via official
$ xcode-select --install
# check the location
$ xcode-select -p
/Library/Developer/CommandLineTools
# check version
$ xcode-select -v
xcode-select version 2384.
```

* CLT contains many things: e.g
    clang/ g++/ gcc: the compiler for c/c++
    curl:
    If there's a newer version of curl available, installing or updating the Xcode Command Line Tools should automatically update curl to the latest version provided by Apple.(i installed another to manage in brew)

# Shell environment setup 
* terminal GUI: change default from "Basic" to "Pro", modify Windows size to "110*30", Text Font size change to "13"

shell: It is command-line interpreter. When you typed in the terminal, there is the actual system code to be execute. e.g when you type ```cd ..```, it will actually execute some system call, which actually interact with the hardware(your computer). terminal can be considered as the platform(text-base GUI) that you can perform the CLI in the shell .

```/usr/bin``` directories are for basic command line programs provided by Apple. (bin: stands for binary)
The ```/usr/local/bin``` is for user-installed executables. e.g code . (command to open via vscode), that trigger the system code, will located here




These are the two zsh shell initialization files that are commonly used for configuration:

1. **~/.zshrc** (Zsh Run Control): This file is the primary configuration file for user-specific shell customizations, such as setting command aliases and adjusting the shell prompt.
(it will execute what inside the .zshrc at first when you open a new terminal windows)
3. **~/.zprofile** (Zsh Profile): This file is read only on login. It's ideal for commands that should be executed only once when a terminal window is opened, such as setting the $PATH environment variable.

* $PATH environment variable determines the directories the shell searches for executable files. It's a list of directory paths, separated by colons (:).

    If you don't set the Mac $PATH, the shell won't be able to locate executable files (usually locate in /bin) or commands, particularly programs you've added that are not basic shell commands.




```bash=
# to print out what current $PATH has
$ echo $PATH
/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

# to add the application's system call path to the current $PATH
export PATH=/path/to/directory:$PATH
# e.g
export PATH=/usr/local/bin:$PATH

# reload the profile
source ~/.zprofile



```

* current file of mine
* .zshrc
```bash=
# version control system display config (when using git)
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats ' %F{87}(%b)%f' #set color display 
alias git='LANG=en_US git' #ensure message in EN
setopt PROMPT_SUBST # Set up the prompt (with git branch name)
PROMPT='[%F{82}%~%f]${vcs_info_msg_0_} $ '

function right_prompt_time() {
  echo "%F{240}[%*]%f"  # [HH:MM:SS] in gray
}
RPROMPT='$(right_prompt_time)'

function set_tab_title() {
    echo -ne "\033]0;($(basename $PWD))\007"
}
precmd() { 
    vcs_info
    set_tab_title }


# setup CLI auto-completion
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
#ZSH_AUTOSUGGEST_STRATEGY=(history)
bindkey '^B' autosuggest-toggle
# autosuggest-accept, default is "->" botton

# setup terminal syntax highlight
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# set up g++ compiler
# alias g++='g++ -std=c++17'

# SSH ocnfig
# decrypt private key message and store in ssh-agent to prevent enter passphrase
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519


# miniconda manage 
# run: conda config --set auto_activate false 
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
        . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
    else
        export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

```
* .zprofile
```bash=
#./zprofile
# set up brew path in CLI
eval "$(/opt/homebrew/bin/brew shellenv)"
# set up python that installed by brew path
export PATH="/opt/homebrew/opt/python@3.12/bin:$PATH"
```


details: [guide1](<https://mac.install.guide/terminal/path>)   [guide src 2](<https://mac.install.guide/homebrew/zsh-command-not-found-brew>)

vs_info
https://git-scm.com/book/sv/v2/Bilaga-A:-Git-in-Other-Environments-Git-in-Zsh


# Homebrew
package management. use it to install/ upgrade software packages (e.g python, curl...)

https://docs.brew.sh/Installation

* requirement: 
we need to install command line tools(CLT) before installing homebrew
* packaged installed via homebrew, it's default installed path for intel ```/usr/local```, ```/opt/homebrew``` for M chip.

* basic: in order to use "brew" command in terminal
```bash=
# use vim to open the it and edit 
vim ~/.zprofile
## add below to the zprofile
eval "$(/usr/local/bin/brew shellenv)" # intel chip
eval "$(/opt/homebrew/bin/brew shellenv)" # M chip

##eval takes a string " " as an argument and evaluates it as if it were a command or set of commands typed directly in the terminal(like to type what inside $( ), directly in the termial)
# above is eqauls to run below (but it may be updated by Homebrew, as what is added is automatically decided by brew) 
# export HOMEBREW_PREFIX="/opt/homebrew";
# export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
# export HOMEBREW_REPOSITORY="/opt/homebrew";
# export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
# export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
# export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

# reload to take effect 
source ~/.zprofile 
# check installed successfully
$ brew doctor
Your system is ready to brew.
```

* install and update
```bash=
# before install check the package size and info
brew list --formula --verbose <package-name>

# install specific package
$ brew install git
# check if the packages installed via homebrew and its info
$ brew info git

# check packages managed by homebrew
$ brew list
$ brew deps --tree --installed # list dependency in tree 

# ====== UPDATE ======
# update homebrew itself
$ brew update
# update all packages managed by homebrew (package_name is optional)
$ brew upgrade package_name
# install macOS application as binary package
$ brew install <package_name> ##adding--verbose to see details behind the scene
# find the package directory installed via brew 
$ brew --prefix python
```
* --cask and --Formulae
--cask it will installed as appplication behavior in your mac


* My list managed by homebrew : git, python@3.x, qemu, allegro.....
* My list NOT managed by brew : Command Line tools
## other
when want to remove completely that install via homebrew
```
[~] $ brew uninstall tabby
==> Uninstalling Cask tabby
==> Backing App 'Tabby.app' up to '/opt/homebrew/Caskroom/tabby/1.0.221/Tabby.app'
==> Removing App '/Applications/Tabby.app'
==> Purging files for version 1.0.221 of Cask tabby
[~] $ rm -rf /opt/homebrew/Caskroom/tabby
[~] $ rm -rf ~/.config/tabby
[~] $ rm -rf ~/Library/Application\ Support/tabby
[~] $ rm -rf ~/Library/Preferences/tabby
[~] $ rm -rf ~/Library/Caches/tabby
[~] $ rm -rf ~/Library/Logs/tabby


# package via brew - python
* basic 
we need to change path (use the one we installed by brew rather than the default package in xcode command line tool). 


```bash=
brew -h #help
brew install python
brew install ipython # easy to use in CLI
# find where it installed via brew
brew --prefix python 
echo 'export PATH="/opt/homebrew/opt/python@3.12/bin:$PATH"' >> ~/.zprofile

source ~/.zprofile # reload
# to check if it's latest 3.12
python3 --version
which python3

```
* python library manager
When install it via brew, it already has pip3 (python library manager). we can use to install e.g ```pip3 install numpy```


# Python: use virtual environment to manage the packages

```bash=
# 1. create a virtual env called (.ds-env) it will create a hidden directory under current directory 
python3 -m venv ~/.ds-env # create all use version python
python3 -m venv ~/.venv # inside project folder, create one .venv for it

# 2. activate the env
cd .ds-env
source bin/activate 

# make sure prompt shows (.ds-env)
# 3. inside .ds-env install commont packages
pip install jupyter numpy scipy scikit-learn matplotlib pandas ipykernel
# ~/.venv/lib/python3.10/site-packages/jupyter/
# 
# verify which Python your .venv points to
cat .venv/pyvenv.cfg
# home = /opt/homebrew/opt/python@3.13/bin
# include-system-site-packages = false
# version = 3.13.5
# executable = /opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13
# command = /opt/homebrew/opt/python@3.13/bin/python3.13 -m venv /Users/tingtingyang/.ds-env

# To remove
# it's just a folder so we can remove completely
rm -rf ~/.ds-env
rm -rf ~/.venv
 
```

# Python: use conda to manage packages


using miniconda to manage

not like venv, we need local install different python and assign version of python in the project folder

conda can also manage the version of python + package (like venv)

but venv can only manage the pacakges , no version
```bash=

# 1. download miniconda and add to path
# mkdir miniconda
# cd miniconda
# skip the process use wget to download and install
# if install in mac
# brew install --cask miniconda

# config setup
conda init
conda config --set auto_activate false 
# it will add PATH your os .zshrc or .tcshrc


# 2. create env with specify python version (Even the local python = 3.6, we cans stil create 3.13 version via conda)
# ** Notes: it's not in the project folder, it's just version manage
conda create -n py313 python=3.13 -y

# 3. activate and pip install MUST inside the env
conda activate py313
which pip 
# /opt/homebrew/Caskroom/miniconda/base/envs/py312/bin/pip
# it temporarily changes PATH to: ~/miniconda/envs/py313/bin/
python -m pip install tensorflow[and-cuda] # use explicit pip


# 4. install common packages:
pip install numpy pandas matplotlib scikit-learn 
pip install "tensorflow[and-cuda]" # must use this!! so tf can use gpu (it installed tf and corresponding cuda)
pip install jupyter ipykernel # to use ipynb interface 


# to dump the current packages sites:
pip freeze > requirements.txt
# to install
pip install -r requirements.txt

# 5. some checks
conda env list 
conda info --envs
# location: miniconda/envs/py313
which pip 
python -m site



# 4. install the package into py313
# cli prompt show (py313)

# register for ipynb to use
python -m ipykernel install --user --name=py313 --display-name "Python (py313)"

```

* if we need to use the py313 but use separate project .venv:

** make sure to activate the py313 first to use the specific py
-> and then go to the project folder to create .venv python -m venv .venv
-> conda deactivate (to leave py313 for version)
-> cd to project folder
-> source .venv/bin/activate
-> then install the packages


## Link the kernel to use ipynb
* link the kernel that a jupyter notebook it should use
a jupyter notebook is like having a interface on top of python interpreter (compiler) , to act like I/O in the console
so the interface need to select a "kernel" to execute

```bash=
# =====  jupyter notebook kernel =====
# 1. above has env created using conda
# the env must pip install jupyter ipykernel

# 2. register the kernel to use the env
# need vscode jupyter extension first
python3 -m ipykernel install --user --name py312 --display-name "Python env(py312)"

# list the available kernels
jupyter kernelspec list
# remove the kernel we don't want
jupyter kernelspec remove cus_env

# /Users/tingtingyang/Library/Jupyter/kernels/.ds-env

# the location of jupyter kernels(if using venv)
ls -al Library/Jupyter/kernels/  # for mac

```
* using conda env:
select python environment
* using .venv: 
and in vscode gui -> install the jupyter extension -> open .ipynb -> on top right corner -> select the kernel -> "Select Another Kernel..." -> "Jupyter Kernel..." -> choose the Python(.ds-env)

so that we can use the package we install inside it



# VS code

* basic install: follow the guide on the official
you can choose to install via official website or via homebrew (I used official install, so the system code is in /usr/local/bin/code)

add path to the $PATH or type ">shell" in the search bar and select ">shell command line: install 'code' command in PATH "
-> create a simlink in the /usr/local/bin
```bash=
$ls -la /usr/local/bin
total 0
drwxr-xr-x  3 root  wheel  96 Oct  4 18:08 .
drwxr-xr-x  3 root  wheel  96 Oct  4 18:08 ..
lrwxr-xr-x  1 root  wheel  68 Oct  4 18:08 code -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
```

* Intellisense(Extensions) Config details: use C/C++ for example [link](<https://code.visualstudio.com/docs/cpp/configure-intellisense>)
    (1) Config and find what compiler it uses?
    As the vs code is only a text editor, not an IDE(can have text editor, compiler and interpreter). When we write code of .cpp, to execute it we should have compiler for c++ installed, which we had via installing CLT.
    Open commend palette(shift+cmd+P or type > in the search bar)> search C/C++ Edit Configurations (JASON) or GUI.
    we can see the C++ is using clang compiler (which is frontend for LLVM [details](<https://stackoverflow.com/questions/5708610/llvm-vs-clang-on-os-x#:~:text=LLVM%20is%20a%20backend%20compiler,a%20representation%20suitable%20for%20LLVM.https://stackoverflow.com/questions/5708610/llvm-vs-clang-on-os-x#:~:text=LLVM%20is%20a%20backend%20compiler,a%20representation%20suitable%20for%20LLVM.>).)
    ![image](https://hackmd.io/_uploads/BkJumnqR6.jpg)
    (2) compile_commands.json file
    Another option to provide IntelliSense configuration is a compile_commands.json file, which describes the exact compile commands used for every file in a project. This file is often generated by a build system, such as CMake or Bazel, by setting command line arguments when configuring your project.



* To write code fast, it has [IntelliSense](<https://code.visualstudio.com/docs/editor/intellisense>) features, which can provide festures of code completion, content assist, and code hinting. e.g there are C/C++, and python extensions to help you write the code in those languages faster.
    [mac clang](<https://code.visualstudio.com/docs/cpp/config-clang-mac>)
    
    4. List of extensions
```bash=
$ code --list-extensions
github.copilot
github.copilot-chat
go2sh.tcl-language-support
ms-python.autopep8
ms-python.debugpy
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-slideshow
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
ms-vscode.live-server
ms-vscode.remote-explorer
mshr-h.veriloghdl
```


* use json to configure setting for whole vscode 
In vscode, press shift + cmd + P (or search >setting.JSON) Preference: Open User Settings (JASON) 
```json=

{
  "workbench.colorTheme": "Default Dark Modern",
  "update.mode": "none",//disable auto update
  "workbench.settings.openDefaultSettings": true,
  "files.autoSave": "afterDelay",
  "editor.fontSize": 14,
  "terminal.integrated.fontSize": 14,
  "editor.tabSize": 2,
  "editor.wordWrap": "on",
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "liveServer.settings.CustomBrowser": "chrome",
  "explorer.confirmDragAndDrop": false,
  "emmet.includeLanguages": {
    "javascript": "html"
  },
  "launch": {
    "configurations": []
  },
  //cpp
  //"C_Cpp.clang_format_path": "",
  //"C_Cpp.formatting": "clangFormat",
  //"C_Cpp.clang_format_sortIncludes": true,  
  //general
    "terminal.integrated.enableMultiLinePasteWarning": false,
  "window.zoomLevel": -1,

  // repidGPT api
  "rapidgpt.apiKey": "rf_qzua3YrZnPYpZY7FGaMGjg3NqUjamGOh"
}
```

# Remote SSH setting
```bash=
vim ~/.ssh/config
```

## avoid entering pwd when login to remote

* Goal: prevent from entering the pwd everytime you log in:
* ed_25519, rsa is the algorithm for the encrypted key
* mechanism: 
generate a pair of key in local (private and public), send the public to remote, and remote grants access if the public key in remote matches with private key in local.
** Private key should always keep in secure in the local machine, **DO NOT** scp to other machines!!
* flow:
local initiate an SSH connection and offer public key
-> remote scan the public key inside ~/.ssh/authorized_keys if match -> remote sends an encrypted challenge (not related to key) -> local machine use the private key to decryptes the challenge. It need the passphrase to use the private key! -> sends back a response of the challenge, proving the local has private key -> remote grants access

```bash=
cd .ssh

# step1. generate a pair of key in your local
ssh-keygen -t ed25519 -C "key_name" -f ./id_tclab1

#-t: tpye of algo/ -C comment to identify the key
# set the passphrase 
# check if it has passphrase
# file ~/.ssh/id_ed25519

# step2. paste the **public key!!! to the server's authorization_key
# method 1
# in local:
scp ~/.ssh/id_ed25519.pub user@remote-server:~/.ssh/
# in remote:
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
# method 2: if ssh supports directly paste the local to the file
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@remote-server

# step3. use the ssh-agent to type the passphrase for you (it stores passphrase in the memory)
# now we don't have enter remote pwd, but it need the passphrase set in step 1 for access private key when verifying, do avoid it.
vim .zshrc #open vim and add below to the .zshrc
# method 1: add to .zshrc
eval "$(ssh-agent -s)" #run cmd, using the output of the () cmd: ssh-agent -s
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

# method 2: let ssh to manage:
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentitiesOnly yes
# lab
Host lab-
  HostName 114.x.a.1
  User tty
  IdentityFile ~/.ssh/id_lab2 # the private key id


# step4. execute below once in cli terminal 
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
# ssh-add ~/.ssh/id_ed25519 # for none-mac

# step5. ensure authorization
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

```

## set the proxy jump
if login node has connect to two compute node cs12, cs13
```
# step1: open the .ssh/config in local!!, if not existing, use touch
vim .ssh/config
 
# step2: enter following info to config
$ cat .ssh/config

Host CAD-root
  HostName nthucad.cs.xxxx.edu.tw
  User tty
  ForwardAgent yes

Host ic51
  HostName ic51
  User tty
  ProxyJump CAD-root

```
https://www.ssh.com/academy/ssh/keygen#what-is-ssh-keygen?

# Github
to cmd to access remote github e.g clone.. 
we need to setup SSH key

[following script of gen key and add to agent](<https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent>)
[manually add ssh-key to github account](<https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account>)

```bash=
# Error message when clone
# git@github.com: Permission denied (publickey).
# fatal: Could not read from remote repository.
# Please make sure you have the correct access rights
# and the repository exists.

$ ls -al ~/.ssh # should have ed25519

# 1. Generate ssh-key use email linked with github
$ ssh-keygen -t ed25519 -C "key_name"
# enter passphrase -> to protect the private key.
# then show "The key fingerprint is:" (a serial no.)-> will need to paste to the github later

# 2. adding your ssh key to the ssh-agent
$ eval "$(ssh-agent -s)"
# if above fail use: 
# ssh-agent > ~/.ssh-agent.env 
# source ~/.ssh-agent.env
Agent pid 90207

# (3.)only for mac below 
# $ touch ~/.ssh/config         #if config not exist 
$ open ~/.ssh/config   
# paste below to the config file
  Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519                              
  
# 4. let ssh agent type passphrase to access private key for you
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519

$ pbcopy < ~/.ssh/id_ed25519.pub
# if not mac use: 
# ssh-add ~/.ssh/id_ed25519
# cat ~/.ssh/id_ed25519.pub


# 5. check
$ ls -al ~/.ssh                                         
total 48
-rw-r--r--@  1 username  staff   564 Dec 11 10:35 config
-rw-------   1 username  staff   464 Dec 11 10:29 id_ed25519
-rw-r--r--   1 username  staff   110 Dec 11 10:29 id_ed25519.pub

$ ssh -T git@github.com
Hi xxx, You've successfully authenticated, but GitHub does not provide shell access
```
# Vim

* key basic: ```i/ Esc``` to switch to Insert/ Command mode. In command mode, type ```:wq``` to save and leave


```bash=
# create vim config file
touch ~/.vimrc
# open file with vim
vim ~/.vimrc
# make sure the .vimrc has content below:
$ cat ~/.vimrc 
syntax on
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4

colorscheme codedark
set background=dark 

# config the vim color to be like in vscode
mkdir -p ~/.vim/colors
curl -o ~/.vim/colors/codedark.vim https://raw.githubusercontent.com/tomasiser/vim-code-dark/master/colors/codedark.vim
# https://github.com/tomasiser/vim-code-dark/blob/master/colors/codedark.vim

```

* advanced config
1. install vim-plug
https://github.com/junegunn/vim-plug
```
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    
# usage the vim-plug to add plugin 
# edit the ~/.vimrc
call plug#begin()

" List your plugins here
Plug 'tpope/vim-sensible'

call plug#end()
```
3. plugin i use: 
nerdtree: https://github.com/preservim/nerdtree?tab=readme-ov-file
```
# just addit the .vimrc and add : 
call plug#begin()
  Plug 'preservim/nerdtree'
call plug#end()
# Restart Vim, and run the :PlugInstall statement to install your plugins.
# then vim-plug will download for you:
# git clone https://github.com/preservim/nerdtree.git ~/.vim/plugged/nerdtree
```
* My vim config
```bash=
[~/.vim] $ tree -L 2                                             
.
├── autoload
│   └── plug.vim
├── colors
│   ├── codedark.vim
│   └── gruvbox.vim
└── plugged
    └── nerdtree
    
[~] $ cat .vimrc                                                 
syntax on
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set number

colorscheme codedark
set background=dark

call plug#begin()
    Plug 'preservim/nerdtree'
call plug#end()

# Example to use
[~/.vim] $ vim .


```


# Filesystem
```
brew install tree
tree 
tree -L 2

# if not install anything:
find .
find . -maxdepth 3
```

# Latex

* install Miktex (compiler for the latex file)
>> brew install --cask miktex-console




```


# Other: load the kaggle dataset
```bash=
# step1: install kaggle in the correct conda env
pip install kaggle

# step2: Get your Kaggle API token
# Go to https://www.kaggle.com/account
# Scroll to API section
# Click “Create New API Token”
# It downloads a file: kaggle.json

# step3: put .kaggle into correct folder 
mkdir -p ~/.kaggle # put the json inside .kaggle
chmod 600 ~/.kaggle/kaggle.json

# step4: download (search in the kaggle dataset)
kaggle competitions download -c <competition-name>
```