Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I install Chocolatey on other drive besides C drive?

Tags:

chocolatey

I love using MacPorts, and Chocolatey is the perfect alternative app.

But when I use Windows, I only install OS on C drive, so if I have any issue with Windows system, I just format my C drive. So, all my files are stored in D or E drive.

I installed Chocolatey, but the default drive is C.

C:\ProgramData\chocolatey

Plus, the default location for installing apps is C drive too. For example, ruby is installed on this location:

// Get Ruby from the repository
choco install ruby

// Then it installed in this location:
C:\tools\ruby213\bin;

Can I set default location to D drive?

like image 454
Kimchi Man Avatar asked Jan 10 '23 13:01

Kimchi Man


2 Answers

Alternate Install Location

With Chocolatey itself, it can, you just need to set the ChocolateyInstall Environmnent Variable:

  1. Create a machine level (user level will also work) environment variable named ChocolateyInstall and set it to the folder you want chocolatey to install to prior to installation (this environment variable must be set globally or available to PowerShell- it is not enough to simply make it available to your current command prompt session).
  2. Create the folder manually.

If you have already installed (and want to change the location after the fact):

  1. Follow the above steps.
  2. Install chocolatey again.
  3. Copy/Move over the items from the old lib/bin directory.
  4. Delete your old install directory.

Application Locations

With apps it becomes a little tougher. Many apps point directly to C:\Program Files. If you have moved that, then they should respect the new location.

With stuff like ruby, it uses Get-BinRoot, when you can just add ChocolateyBinRoot as an environment variable and it will point those things there.

Create Environment Variables

You can use the following steps to create an Environment Variable:

  1. Click the Start Button
  2. Right Click on "Computer" and select Properties (or press Windows Key + Pause/Break)
  3. The System Window should appear, click ```Advanced System Settings" link
  4. The System Properties Window should appear, click Environment Variables button
  5. In there, create either a User/Machine level Environment variable for ChocolateyInstall, with the Value set to the path that you want to use
like image 67
ferventcoder Avatar answered Mar 14 '23 21:03

ferventcoder


I changed the ProgramFilesDir in regedit here: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

After that chocolatey installs to the new folder I set.

like image 44
heyhugo Avatar answered Mar 14 '23 23:03

heyhugo