You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
254 lines
11 KiB
254 lines
11 KiB
# Windows Install Scripts for Real Programmers
|
|
|
|
This is a collection of automated installer scripts for "real programmers." These scripts will
|
|
install various base packages most programmers need, and then specific packages you'll need to work
|
|
in the language you choose. The scripts are based on [Chris Titus' Winutil](https://github.com/ChrisTitusTech/winutil) but redesigned to allow you to run the script as a normal user and becoming admin as needed. If you want more software then check out Chris' very nice script.
|
|
|
|
> _UPDATE FOR 2025_ The latest version of these scripts features only WinGet for installation.
|
|
> Chocolatey doesn't update their packages often enough and WinGet is officially supported by
|
|
> Microsoft. This does mean though that we have to deal with Microsoft employees doing weird things
|
|
> with the PATH so please read about `pathfixer.ps1` below.
|
|
|
|
## How to Use It
|
|
|
|
First, you run the `base.ps1` script to get an initial setup of basic things all other languages
|
|
need. This allows you to then install any other languages very quickly:
|
|
|
|
```shell
|
|
irm https://git.learnjsthehardway.com/learn-code-the-hard-way/lcthw-windows-installers/raw/branch/master/base.ps1 -outfile base.ps1
|
|
powershell -executionpolicy bypass .\base.ps1
|
|
```
|
|
|
|
### Fixing the PATH
|
|
|
|
There is now a problem you need to fix with the PATH. As usual, Microsoft uses the PATH as a way to
|
|
suppress competing software. Yes, this is as dumb and banal as it sounds, but when you look at bug
|
|
reports from WinGet developers regarding the PATH they claim you have to have Administrator rights
|
|
and create symlinks just to put things in the PATH. Yet, here's 2 lines of PowerShell that does it:
|
|
|
|
```shell
|
|
$newPath = $env:PATH + ";$winlibsPath\mingw64\bin"
|
|
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
```
|
|
|
|
Yes, this is all you need to do, but Microsoft employees weirdly won't put certain competing
|
|
products in the PATH in order to add friction to the install so that people just give up and use
|
|
their commercial products. As I said, this is about the stupidest most banal things ever, and we'll
|
|
fix it with an equally stupid and banal PowerShell script:
|
|
|
|
``
|
|
irm https://git.learnjsthehardway.com/learn-code-the-hard-way/lcthw-windows-installers/raw/branch/master/pathfixer.ps1 -outfile pathfixer.ps1
|
|
powershell -executionpolicy bypass .\pathfixer.ps1
|
|
``
|
|
|
|
The `pathfixer.ps1` script checks if the PATH is missing for WinLibs and Git (yes, only these two
|
|
are missing, and incidentally Microsoft has a competitor to both). If these directories are not in
|
|
the PATH it adds them. _This script will also make a backup of your path and place it in
|
|
`path_backup.txt`_.
|
|
|
|
|
|
## Adding Python
|
|
|
|
After this script runs you should be ready, but close this PowerShell instance and start a new one
|
|
just in case. Then run this:
|
|
|
|
```shell
|
|
irm https://git.learnjsthehardway.com/learn-code-the-hard-way/lcthw-windows-installers/raw/branch/master/python.ps1 -outfile python.ps1
|
|
powershell -executionpolicy bypass .\python.ps1
|
|
```
|
|
|
|
If you get an error that "Chocolatey is not installed" then you forgot to close your PowerShell and
|
|
start a new one. It's because the PATH needs to be reset because Windows is dumb.
|
|
|
|
You can also use `winget` and/or `choco` to install what you want manually. See the instructions
|
|
below for your language to learn how to do that, or get the script and just look at it. Usually the
|
|
only thing each language script does is run some `winget` commands.
|
|
|
|
## Base Packages
|
|
|
|
The `base.ps1` script installs the following packages:
|
|
|
|
* [winget](https://github.com/microsoft/winget-cli) -- Package installer created by Microsoft.
|
|
* [git](https://git-scm.com/) -- Installed via winget.
|
|
* [Windows Terminal](https://github.com/microsoft/terminal) -- The new Terminal package for Windows 10/11.
|
|
* [CMake](https://cmake.org/) -- Used in quite a lot of builds for plugins in other languages.
|
|
* [Visual C++ Redist 2015+](https://www.microsoft.com/en-us/download/details.aspx?id=48145) -- Also used in a lot of builds and runtimes.
|
|
* [Geany](https://www.geany.org/) -- A nice cross platform basic programmer's editor.
|
|
* [winlibs](https://winlibs.com/) -- The GCC toolchain compiled for Windows.
|
|
* [wizfile](https://antibody-software.com/wizfile/) -- An insanely useful file search tool, so useful I just include it always.
|
|
* [sqlite3](https://www.sqlite.org/) -- Another insanely useful tool that seems to be used in lots of projects.
|
|
* [ugrep](https://github.com/Genivia/ugrep) -- Another very useful tool for simply searching in files. If you want regular GNU grep
|
|
then start an Administrator Terminal and type `winget install GnuWin32.Grep`.
|
|
|
|
This sets you up with most things every programmer needs no matter what language, and if you already
|
|
installed something it will be skipped or upgraded instead. If you don't want to install something,
|
|
just edit the script at the end and remove that line.
|
|
|
|
Each language specific script then installs additional packages. Also, these scripts should be
|
|
compatible with each other since they won't install things more than once.
|
|
|
|
### `cpp.ps1` for C/C++
|
|
|
|
This script is meant for C/C++ programming and installs the following:
|
|
|
|
* GNU Make -- A very useful C++ package system that helps get access to C++ libraries.
|
|
* [conan](https://conan.io) -- A very useful C++ package system that helps get access to C++ libraries.
|
|
* [meson](https://mesonbuild.com/) -- So far the best cross platform build tool I've found, but it does have it's own problems.
|
|
|
|
I also recommend you install [vcpkg](https://github.com/microsoft/vcpkg) to get access to even more C++ packages. Meson and CMake should use vcpkg installed packages.
|
|
|
|
To install yourself run:
|
|
|
|
```shell
|
|
winget install ezwinports.make
|
|
winget install mesonbuild.meson
|
|
winget install Kitware.CMake
|
|
```
|
|
|
|
The `winlibs` command is just to make sure it gets installed for people who don't use the `base.ps1`
|
|
script or if that script changes and doesn't install it as a base component. That means it may do
|
|
nothing since you already have `winlibs`.
|
|
|
|
### Either `nodejs.ps1` or `bunjs.ps1` for JavaScript
|
|
|
|
The `nodejs.ps1` script installs:
|
|
|
|
* [NodeJS LTS](https://nodejs.org/en) -- I default to the LTS version but you can change it to the
|
|
latest if you want.
|
|
|
|
To install this manually do:
|
|
|
|
```shell
|
|
winget install OpenJS.NodeJS.LTS
|
|
```
|
|
|
|
You can also install the latest version by using `OpenJS.NodeJS` instead of `OpenJS.NodeJS.LTS`.
|
|
|
|
The `bunjs.ps1` script installs:
|
|
|
|
* [Bun.js](https://bun.sh/) -- Keep in mind that I do not use this and I'm only including it to be
|
|
complete. If you have suggestions to improve this installer then let me know.
|
|
|
|
```shell
|
|
winget install Oven-sh.Bun
|
|
```
|
|
|
|
### `python.ps1` for Python
|
|
|
|
* [Anaconda](https://www.anaconda.com/) -- This is mostly because I use it in my course, so feel free to edit the script and not install this.
|
|
* [Python 3](https://apps.microsoft.com/detail/9ncvdn91xzqp?hl=en-mt&gl=MT) -- Yes, the one from the Microsoft store because it's the only Python installer that seems to be "allowed" to place itself in the PATH despite every other installer saying this is basically illegal.
|
|
|
|
To install yourseful run:
|
|
|
|
```shell
|
|
winget install Anaconda.Anaconda3
|
|
winget install Python.Python.3.12
|
|
```
|
|
|
|
### `ruby.ps1` for Ruby
|
|
|
|
* [ruby](https://www.ruby-lang.org/en/) -- I'm actually not very up on Ruby these days so advice on
|
|
the script welcome.
|
|
|
|
To install this yourself do:
|
|
|
|
```shell
|
|
winget install RubyInstallerTeam.Ruby.3.2
|
|
```
|
|
|
|
There is an alternative package that installs a "dev kit" but I'm not sure how this will interact
|
|
with the `winlibs` package and other things installed so far. If you have any information on which
|
|
one to use let me know.
|
|
|
|
```shell
|
|
winget install RubyInstallerTeam.RubyWithDevKit.3.2
|
|
```
|
|
|
|
### `go.ps1` for Go
|
|
|
|
* [go](https://go.dev/) -- The Go language.
|
|
|
|
To install this yourself use:
|
|
|
|
```shell
|
|
winget install GoLang.Go
|
|
```
|
|
|
|
### `rust.ps1` for Rust
|
|
|
|
* [Rust](https://www.rust-lang.org/) -- The Rust language for the GNU Toolchain.
|
|
|
|
To install this yourself use:
|
|
|
|
```shell
|
|
winget install Rustlang.Rust.GNU
|
|
```
|
|
|
|
### `zig.ps1` for Zig
|
|
|
|
* [Zig](https://ziglang.org/) -- The Zig language.
|
|
* [zigtools.zls](https://github.com/zigtools/zls) -- Zig Language Server.
|
|
|
|
To install this yourself use:
|
|
|
|
```shell
|
|
winget install zig.zig
|
|
winget install zigtools.zls
|
|
```
|
|
|
|
### `crystal.ps1` for Crystal
|
|
|
|
* [Crystal](https://crystal-lang.org/) -- The base crystal language.
|
|
|
|
To install this yourself use:
|
|
|
|
```shell
|
|
winget install CrystalLang.Crystal
|
|
```
|
|
|
|
## The `extras.ps1` Script
|
|
|
|
This is a script of additional useful tools I like to use for a better developer experience:
|
|
|
|
* GnuWin32.Which -- The `which` command to find where stuff is, 'cause that's useful.
|
|
* GNU.Wget2 -- Windows has its own hijack of wget and curl so this installs the real deal insead.
|
|
* GNU.Nano -- Useful terminal only editor for quick edits of files.
|
|
* eza-community.eza -- A nice `ls` alternative that gives better output than the obnoxious full form output PowerShell gives.
|
|
* cURL.cURL -- Like wget2 it's a standard tool for grabbing things off the web.
|
|
|
|
## The `bigtest.ps1` Script
|
|
|
|
There's a test script that you can run if you want to install all scripts from the git repo to test
|
|
it. You
|
|
use it like this:
|
|
|
|
```shell
|
|
irm https://git.learnjsthehardway.com/learn-code-the-hard-way/lcthw-windows-installers/raw/branch/master/base.ps1 -outfile base.ps1
|
|
powershell -executionpolicy bypass .\base.ps1
|
|
```
|
|
|
|
Then close your PowerShell to ensure you get the `winget` and `choco` installs. Then run the
|
|
`bigtest.ps1` script and be sure to stay near your computer to keep entering your password:
|
|
|
|
```shell
|
|
irm https://git.learnjsthehardway.com/learn-code-the-hard-way/lcthw-windows-installers/raw/branch/master/bigtest.ps1 -outfile bigtest.ps1
|
|
powershell -executionpolicy bypass .\bigtest.ps1
|
|
```
|
|
|
|
After that you'll have every language I've figured out. Be sure to email
|
|
help@learncodethehardway.com and tell me if it worked or not for you.
|
|
|
|
## Contributing Installers
|
|
|
|
If you have a language that needs this kind of installer then feel free to grab one of these and
|
|
modify it. If you can test that works and want me to include it then do a patch or pull request
|
|
with your new script and I'll take a look. Due to the unsafe nature of these scripts I'll only be
|
|
accepting PRs from people with an identifiable presence online, an actual face picture, and full
|
|
real name. Basically, if I can't get you arrested for trying to hack people then I won't accept
|
|
your script.
|
|
|
|
Be sure to test your scripts under the following conditions:
|
|
|
|
1. Windows Home 10 -- Remember, the point is to make it easy for anyone to get your language, so Windows Pro is a non-starter.
|
|
2. As a __non-admin__ user. This is important, as if your script only runs as administrator then it's dead on arrival.
|
|
3. Users will have a second account that is admin which they can enter a password for, and the scripts currently automatically switch to administrator as needed.
|
|
|