0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MacBookを初期化・再構築した話

Posted at

経緯

私は大学2年生で、いわゆる情報学・コンピュータサイエンスを学んでいます。しかし、大学に入学する前までは、プログラミングはおろか、Word、Excel、PowerPointくらいしか使ったことがありませんでした。HTMLも知らなかったし、もちろんターミナルなんて触ったこともなかったです。

大学入学当初、パソコンに疎かった私は授業や開発で必要なアプリケーションやツールを適当にインストールしてしまいました。その結果、ディレクトリがかなり汚れてしまい、なんでこのソフト入れたんだっけとかまあいいや消しちゃえとかしてたら変なファイルが存在してるとかいう事件がよくありました

大学入学から2年、授業でプログラミングしたりプライベートでWebアプリの開発を学んだりする中でちょっとくらいはパソコンに詳しくなった気がするので、春休みで開発をより効率よく進めるためにこのタイミングでMacBookを初期化し環境を一新しようと決めました。

本記事ではそのメモをここに残そうと思います。

ちなみに使っているのはMacBook Air M2です。

再構築の計画

本体設定

  • トラックパッドの感度
  • TouchIDの設定
  • カーソルのサイズ
  • Finderの色々
    • 拡張子
    • ステータスバー、パスバー
  • dockの設定
  • スクリーンショットを特定のフォルダに入れる
  • キーボード関連
    • キーリピート速度
    • 不要な入力ソースの削除
    • デフォルトバックスラッシュ
  • ズーム機能
  • 不要なアプリ削除
  • 起動時のサウンドオフ
  • ターミナルの見た目
  • 壁紙

書類

  • よく使う重要なデータはiCloud Driveに保存されているので大丈夫
  • texliveはhomebrewでインストールできるらしい
  • ダウンロード内はほぼゴミ箱なので消えても問題なし

アプリケーション

  • Chrome
    • デフォルトブラウザ設定
  • LINE
  • Discord
  • slack
  • zoom
  • word, excel, powerpoint, teams,outlook
  • onedrive(大学用)
  • alfled
  • vscode
  • homebrew
    • texlive
    • pyenv,python
    • mysql
  • eclipse
  • keyboardcleantool
  • runcat
  • ice
  • appcleaner

vscode設定

LaTeXを書けるようにする

  • LaTeX Workshopを入れる
  • setting.json
{
    "workbench.colorTheme": "Default Light+",

    // 和文を使うため、助詞、句読点、全角括弧などを区切り文字として登録する
    "editor.wordSeparators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~? 、。「」【】『』()!?てにをはがのともへでや",

    
    // Tool の定義
    "latex-workshop.latex.tools": [
      
        // latexmk によるlualatex
        {
          "name": "Latexmk (LuaLaTeX)",
          "command": "latexmk",
          "args": [
            "-f", "-gg", "-pv", "-lualatex", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-directory=%OUTDIR%", "%DOC%"
          ]
        },
        // latexmk による xelatex
        {
          "name": "Latexmk (XeLaTeX)",
          "command": "latexmk",
          "args": [
            "-f", "-gg", "-pv", "-xelatex", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-directory=%OUTDIR%", "%DOC%"
          ]
        },
        // latexmk による uplatex
        {
          "name": "Latexmk (upLaTeX)",
          "command": "latexmk",
          "args": [
            "-f", "-gg", "-pv", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-directory=%OUTDIR%", "%DOC%"
          ]
        },
        // latexmk による platex
        //こいつ使うときもしかしたらpdf生成されずにdviまでしかできないかも
        {
          "name": "Latexmk (pLaTeX)",
          "command": "latexmk",
          "args": [
            "-f", "-gg", "-pv", "-latex='platex'", "-latexoption='-kanji=utf8 -no-guess-input-env'", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-directory=%OUTDIR%", "%DOC%"
          ]
        }
    ],

    // Recipe の定義
    "latex-workshop.latex.recipes": [
        // LuaLaTeX のレシピ
        {
          "name": "LuaLaTeX",
          "tools": [
            "Latexmk (LuaLaTeX)"
          ]
        },
        // XeLaTeX のレシピ
        {
          
          "name": "XeLaTeX",
          "tools": [
            "Latexmk (XeLaTeX)"
          ]
        },
        // upLaTeX のレシピ
        {
          "name": "upLaTeX",
          "tools": [
            "Latexmk (upLaTeX)"
          ]
        },
        // pLaTeX のレシピ
        {
          "name": "pLaTeX",
          "tools": [
            "Latexmk (pLaTeX)"
          ]
        },
    ],

    // マジックコメント付きの LaTeX ドキュメントのビルド設定
    // 特に記事では扱わないが、いつか使うことを考えて書いとく。
    // 参考: https://blog.miz-ar.info/2016/11/magic-comments-in-tex/
    "latex-workshop.latex.magic.args": [
      "-f", "-gg", "-pv", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOC%"
    ],

    // 不要なファイルをクリーンアップする時の目印となる拡張子
    // 不要な一時ファイルや中間ファイルを自動削除する機能がある。
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux", "*.bbl", "*.blg", "*.idx", "*.ind", "*.lof", "*.lot", "*.out", "*.toc", "*.acn", "*.acr", "*.alg", "*.glg", "*.glo", "*.gls", "*.ist", "*.fls", "*.log", "*.fdb_latexmk", "*.synctex.gz",
        // for Beamer files
        "_minted*", "*.nav", "*.snm", "*.vrb",
    ],

    // ビルド失敗した際の残存ファイルが以降のビルドに影響を与えることがあるため、
    // 残存ファイルを削除する設定
    "latex-workshop.latex.autoClean.run": "onBuilt",

    // PDFビューワの開き方。画面分割で開く。
    "latex-workshop.view.pdf.viewer": "tab",

    // LaTeXファイル保存時にPDFも更新するかどうか。
    // LuaLaTeXはビルドが遅いので、かえって煩わしいので無効化
    // (u)pLaTeXなら有効化しておいてもいいかも。
    "latex-workshop.latex.autoBuild.run": "never",

    "[tex]": {
        // スニペット補完中にも補完を使えるようにする
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // インデント幅を2にする
        "editor.tabSize": 2
    },

    "[latex]": {
        // スニペット補完中にも補完を使えるようにする
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // インデント幅を2にする
        "editor.tabSize": 2
    },

    "[bibtex]": {
        // インデント幅を2にする
        "editor.tabSize": 2
    },

    // 使用パッケージのコマンドや環境の補完を有効化
    "latex-workshop.intellisense.package.enabled": true,

    // 作成したファイルを、直下の "out" フォルダへ出力
    "latex-workshop.latex.outDir": "out",
    "redhat.telemetry.enabled": true,
}
  • レポート用のスニペット
{
    "report": {
        "prefix": "report",
        "body": [
            "\\documentclass{${1:ltjsarticle}}",
            "",
            "",
            "% 数式",
            "\\usepackage{amsmath,amsfonts}",
            "\\usepackage{bm}",
            "% 画像",
            "\\usepackage{graphicx}",
            "% コード",
            "\\usepackage{listings,jvlisting}",
            "\\renewcommand{\\lstlistingname}{ソースコード}",
            "%わからん",
            "\\usepackage{luatexja}",
            "${2}",
            "\\lstset{",
                "basicstyle={\\ttfamily},",
                "identifierstyle={\\small},",
                "commentstyle={\\smallitshape},",
                "keywordstyle={\\small\\bfseries},",
                "ndkeywordstyle={\\small},",
                "stringstyle={\\small\\ttfamily},",
                "frame={tb},",
                "breaklines=true,",
                "columns=[l]{fullflexible},",
                "numbers=left,",
                "xrightmargin=0pt,",  
                "xleftmargin=3pt,",
                "numberstyle={\\scriptsize},",
                "stepnumber=1,",
                "numbersep=1pt,",
                "lineskip=-0.5ex,",
            "}",
            "",
            "\\begin{document}",
            "",
            "\\title{表題}",
            "\\author{202312002 荻原想大}",
            "\\date{${3:\\today}}",
            "\\maketitle",
            "\\part{大見出し}",
            "\\section{見出し1}",
            "\\subsection{見出し2}",
            "",
            "\\end{document}"
        ],
        "description": "授業レポート用テンプレート"
    },

    "zu": {
        "prefix": "zu",
        "body": [
            "\\begin{figure}[ht]",
            "    \\centering",
            "    \\includegraphics[scale = 0.5]{}",
            "    \\caption{}",
            "\\end{figure}"
        ],
        "description": "画像挿入用テンプレート"
    },

    "hyo": {
        "prefix": "hyo",
        "body": [
            "\\begin{table}[ht]",
            "   \\centering",
            "   \\caption{}",
            "   \\begin{tabular}{c|c|c}",
            "       \\hline",
            "       head1 & head2 & head3 \\\\",
            "       \\hline",
            "       cell & cell & cell \\\\",
            "       \\hline",
            "   \\end{tabular}",
            "\\end{table}"
        ],
        "description": "表挿入用テンプレート"
    }
}

  • .latexmkrc
#!/usr/bin/env perl

# LaTeX
$latex = 'platex -synctex=1 -halt-on-error -file-line-error %O %S';
$max_repeat = 5;

# BibTeX
$bibtex = 'pbibtex %O %S';
$biber = 'biber --bblencoding=utf8 -u -U --output_safechars %O %S';

# index
$makeindex = 'mendex %O -o %D %S';

# DVI / PDF
$dvipdf = 'dvipdfmx %O -o %D %S';
$pdf_mode = 3;

# preview
$pvc_view_file_via_temporary = 0;
if ($^O eq 'linux') {
    $dvi_previewer = "xdg-open %S";
    $pdf_previewer = "xdg-open %S";
} elsif ($^O eq 'darwin') {
    $dvi_previewer = "open %S";
    $pdf_previewer = "open %S";
} else {
    $dvi_previewer = "start %S";
    $pdf_previewer = "start %S";
}

# clean up
$clean_full_ext = "%R.synctex.gz"

その他拡張機能

  • Japanese Language Pack for Visual Studio
  • C/C+, Extention Pack
  • Code Runner
  • javascript snippets

参考になった

初期化直後の状態を見てみる

こんなに汚かったホームディレクトリが

スクリーンショット 2025-02-13 15.57.57.png

こんなに綺麗に!!

Screenshot 2025-02-13 at 22.11.14.png

ちなみに初期化したてはこれ

Screenshot 2025-02-13 at 16.16.08.png

何がどうなってあんなに汚くなっていたのかはわからない

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?