question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The system cannot open the device or file specified. : 'PSReadLineHistoryFile_3946503603'

See original GitHub issue

Unable to run Powershell or Preview on MacOS if the PSReadline Module is loaded.

The error is:

Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new

Environment

PSReadLine: 2.0.0-rc1 PowerShell: 7.0.0 OS: Darwin 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 Last 0 Keys


Exception

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_3946503603'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

Powershell lods fine if I delete / rename / dont load the PSReadLine module.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
daxian-dbwcommented, May 18, 2020

@FiggyRoll Thanks for reporting back on this with additional information! I will resolve this as a duplicate of #1464 and move your last comment to it. I really appreciate for the additional information.

1reaction
FiggyRollcommented, Apr 24, 2020

Hi @iSazonov

Sure. In terms of more info.

Running iterm2 using zsh on MacOS, and Powershell is installed using brew. Has failed since I updated to Powershell 7 from 6.

brew cask uninstall powershell brew cask install powershell

Updating Homebrew… ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). => Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.0.0/powershell-7.0.0-osx-x64.pkg Already downloaded: /Users/785207/Library/Caches/Homebrew/downloads/c509d60c30f795663f2d92d5ce54dc4ea3a700fed889ca40f66666df05ce4d14–powershell-7.0.0-osx-x64.pkg ==> Verifying SHA-256 checksum for Cask ‘powershell’. ==> Installing Cask powershell ==> Running installer for powershell; your password may be necessary. ==> Package installers may write to any location; options such as --appdir are ignored. installer: Package name is PowerShell - 7.0.0 installer: Installing at base path / installer: The install was successful. 🍺 powershell was successfully installed!

then run powershell from iterm2

pwsh

first time running probably takes 10 - 15 seconds then the error above appears. Just checked using the native terminal as well and receive the same error.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is PSReadLine History File missing and ...
When running Powershell 5.1.19041.1682 in the Powershell_ISE Version 10.0.19041.1 (Windows 10) host the HistorySavePath property is set to a ...
Read more >
Error reading or writing history file in PowerShell
Next, we check file permissions: 1. Right-click on the history file located at `C:\Users\User\AppData\Roaming\Microsoft\Windows\PowerShell\ ...
Read more >
about PSReadLine - PowerShell
PSReadLine maintains a history file containing all the commands and data you've entered from the command line. The history files are a file...
Read more >
Powershell history isn't persistent anymore
Seems the PSReadLine module isn't loading. Using Import-Module PSReadLine makes the history work properly. As a workaround, I put the command ...
Read more >
Untitled
Powershell file mutex Web8 de jul. de 2021 · the mutex is to guard the read/write ... Mutex constructor fails with "system cannot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found