Cygwin のインストール(Windows 上)

Cygwinは,Linux と類似の機能を提供するツールとライブラリ

主な機能:ツール,POSIX API(cygwin1.dll)

  1. Windows で,コマンドプロンプト管理者権限で起動する(例:Windowsキーを押し,「cmd」と入力し,「管理者として実行」を選択)
  2. 次のコマンドを実行

    次のコマンドは,Cygwinをインストールし,パスを通すものである.

    winget install --scope machine Cygwin.Cygwin
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\cygwin64\sbin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\cygwin64\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\cygwin64\use\sbin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\cygwin64\use\local\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    
  3. 再度,Windows で,コマンドプロンプト管理者権限で起動する(例:Windowsキーを押し,「cmd」と入力し,「管理者として実行」を選択)
  4. setup-x86_64.exe のダウンロード,wget のインストール
    cd c:\cygwin64
    curl -O https://www.cygwin.com/setup-x86_64.exe
    .\setup-x86_64.exe -q -P wget
    .\setup-x86_64.exe -q -P gcc-core
    .\setup-x86_64.exe -q -P gcc-fortran
    .\setup-x86_64.exe -q -P gcc-g++
    .\setup-x86_64.exe -q -P gdb
    .\setup-x86_64.exe -q -P make
    

関連する外部ページ

(参考) いくつかの追加設定

必要に応じてcygwin1.dll のコピーを行っておく

必要に応じて、Windows のシステム環境変数を次のように設定しておく(必要な場合に限る)

(参考) アンインストールについて

アンインストールは、普通、次の手順をとる。

  1. c:\cygwin の削除
  2. レジストリの削除 (regedit 等を使用)

    HKEY_LOCAL_MACHINE/SOFTWARE/Cygnus Solutions

    HKEY_CURRENT_USER/Software/Cygnus Solutions