environment variables – Ruby Gem Change SPEC CACHE DIRECTORY from non-existing disk to path


When trying to install a gem i receive an error:

ERROR: While executing gem... (Errno:ENXIO)
No such device or address @ rb_file_s_stat - Z:/

when checking the gem environment variables i get the following return:

C:Program Files (x86)SOME_FOLDERRubybin>gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.6
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) (x64-mingw32)
  - INSTALLATION DIRECTORY: C:/Program Files (x86)/SOME_FOLDER/Ruby/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: Z:/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: "C:/Program Files (x86)/SOME_FOLDER/Ruby/bin/ruby.exe"
  - EXECUTABLE DIRECTORY: C:/Program Files (x86)/SOME_FOLDER/Ruby/bin
  - SPEC CACHE DIRECTORY: Z:/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Program Files (x86)/SOME_FOLDER/Ruby/lib/ruby/gems/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:Program Files (x86)Common FilesOracleJavajavapath
     - C:Windowssystem32
     - C:Windows
     - C:WindowsSystem32Wbem
     - C:WindowsSystem32WindowsPowerShellv1.0
     - C:WindowsSystem32OpenSSH
     - C:Program FilesTortoiseSVNbin
     - C:UsersrekenmtAppDataLocalMicrosoftWindowsApps

the problem is clear: USER INSTALLATION DIRECTORY and SPEC CACHE DIRECTORY are not valid paths (Z:/ disk does not exist.) the question therefore is:

how do i change those variables to point to another path

Thank you in advance